protected override void BuildPatterns(IGroupManager g, IPatternBuilder p, dynamic c) { g.Define("open").AppendOrCreate(new[] { "打開", "開" }); g.Define("close").AppendOrCreate(new[] { "關上", "關" }); g.Define("door").AppendOrCreate(new[] { "門", "房間門", "房門" }); g.Define("light").AppendOrCreate(new[] { "燈", "檯燈" }); p.Build(g["open"], g["door"]).OnInvoke(score => { Debug.WriteLine("門的狀態是: " + (this._doorState ? "開著的" : "關著的")); // 開門 if (!this._doorState) { this._doorState = !this._doorState; return(Moods.Happy, "已經開好門囉 <3"); } else { return new Response[] { (Moods.Sad, "可是門本來就是開的欸 QAQ"), (Moods.Normal, "喔是喔,不過就是一扇門,早就開好了"), (Moods.Sad, "可是門本來就是開的欸 QAQ"), } } .RandomTakeOne(); });
protected override void BuildPatterns(IGroupManager g, IPatternBuilder p, dynamic config, dynamic session) { var open = g.Define("open"); open.AppendOrCreate(new[] { "打開", "開啟" }); var facebook = g.Define("facebook"); facebook.AppendOrCreate(new[] { "臉書", "facebook", "fb" }); p.Build(open, facebook).OnInvoke(this.OnInvoke); }