public void ResponseCommandListMessage()
        {
            var dc = new BotDataContext(this.UserCD);

            var l = new List <IButton>();

            {
                var bt = new PostbackButton();
                bt.Title = this.Text(BotTextKey.AddNewSchedule);
                var cm = new PayloadCommand();
                cm.CommandName = BotCommandName.StartCommand;
                cm.MethodName  = "StartCommand";
                cm.Value       = nameof(BotCommandName.ScheduleAdd);
                bt.SetPayload(cm);
                l.Add(bt);
            }
            {
                var bt = new PostbackButton();
                bt.Title = this.Text(BotTextKey.AddNewTask);
                var cm = new PayloadCommand();
                cm.CommandName = BotCommandName.StartCommand;
                cm.MethodName  = "StartCommand";
                cm.Value       = nameof(BotCommandName.TaskAdd);
                bt.SetPayload(cm);
                l.Add(bt);
            }
            {
                var bt = new PostbackButton();
                bt.Title = this.Text(BotTextKey.TaskConfirmation);
                var cm = new PayloadCommand();
                cm.CommandName = BotCommandName.StartCommand;
                cm.MethodName  = "StartCommand";
                cm.Value       = nameof(BotCommandName.TaskComplete);
                bt.SetPayload(cm);
                l.Add(bt);
            }
            foreach (var item in dc.BotCommand_List_Get())
            {
                if (item.CommandName == BotCommandName.StartCommand)
                {
                    continue;
                }
                var cm = BotCommand.Create(this.RecipientID, this.BotCD, item);
                var bt = new PostbackButton();
                bt.Title = cm.GetText();
                bt.SetPayload(BotCommandName.StartCommand, "RestartCommand", item.CommandCD.ToString());
                l.Add(bt);
            }
            this.SendImage(BotActionType.Greeting);
            var cl = new FacebookBotClient();

            foreach (var item in ButtonTemplateMessage.Create(this.RecipientID
                                                              , this.TextManager.Text(BotTextKey.CanIHelpYou), l))
            {
                cl.SendMessage(item);
            }
            dc.BotCommand_Update(_Record);
        }
示例#2
0
        public void UpdateCommandData()
        {
            var dc = new BotDataContext(this.UserCD);

            dc.BotCommand_Update(_Record);
        }