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); }
protected override void BuildPatterns(IGroupManager g, IPatternBuilder p, dynamic config, dynamic session) { g.Define("pause").AppendOrCreate(new[] { "暫停" }); g.Define("resume").AppendOrCreate(new[] { "繼續" }); g.Define("play").AppendOrCreate(new[] { "播放" }); g.Define("next").AppendOrCreate(new[] { "下一首" }); g.Define("previous").AppendOrCreate(new[] { "上一首" }); g.Define("song").AppendOrCreate(new[] { "歌", "歌曲", "曲目", "樂曲", "音樂" }); Invoke pause = m => { Task.WaitAll(this.CheckToken()); var er = this._api.PausePlayback(); if (er.HasError()) { return(Moods.Sad, er.Error.Message); }