コード例 #1
0
ファイル: Keyboards.cs プロジェクト: caisilus/sbornic_bot
        public static IKeyboardBuilder PostHandlingKeyboardBuilder()
        {
            /*var buttonHelp = new MessageKeyboardButtonAction()
             * {
             *  Type = KeyboardButtonActionType.Text,
             *  Label = "Помощь",
             *  Payload = "{\"command\": \"postEventHelp\"}",
             * };*/
            var buttonAttachTag = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Прикрепить тэг",
                Payload = "{\"command\": \"attachTag\"}",
            };
            var buttonDetachTag = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Открепить тэг",
                Payload = "{\"command\": \"detachTag\"}"
            };
            var buttonTagsList = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Список тэгов",
                Payload = "{\"command\": \"tagsListPostHandling\"}"
            };
            var buttonSend = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Отправить",
                Payload = "{\"command\": \"sendPost\"}"
            };
            var buttonCancel = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Отмена",
                Payload = "{\"command\": \"cancelPost\"}"
            };
            IKeyboardBuilder keyboardBuilder = new KeyboardBuilder();

            //keyboardBuilder.AddButton(buttonHelp,KeyboardButtonColor.Default);
            //keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonAttachTag, KeyboardButtonColor.Primary);
            keyboardBuilder.AddButton(buttonDetachTag, KeyboardButtonColor.Negative);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonSend, KeyboardButtonColor.Positive);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonTagsList, KeyboardButtonColor.Default);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonCancel, KeyboardButtonColor.Negative);

            return(keyboardBuilder);
        }
コード例 #2
0
        public MessageKeyboardButton GetButton(Keyboard keyboard, long groupId)
        {
            var action = new MessageKeyboardButtonAction()
            {
                Type = KeyboardButtonActionType.VkPay,
                Hash = VkPay.ToString()
            };

            return(new MessageKeyboardButton()
            {
                Action = action
            });
        }
コード例 #3
0
        public MessageKeyboardButton GetButton(Keyboard keyboard, long groupId)
        {
            var action = new MessageKeyboardButtonAction()
            {
                Type  = KeyboardButtonActionType.OpenLink,
                Label = Label,
                Link  = new Uri(Link)
            };

            return(new MessageKeyboardButton()
            {
                Action = action
            });
        }
コード例 #4
0
        public KeyboardBackButton()
        {
            var newKeyBoard = new GetKeyboard();

            Action = new MessageKeyboardButtonAction()
            {
                Label   = newKeyBoard.ButtonLabel,
                Type    = KeyboardButtonActionType.Text,
                Payload = new Payload()
                {
                    Command = newKeyBoard.KeyWord
                }.Serialize(),
            };
            Color = KeyboardButtonColor.Default;
        }
コード例 #5
0
        public MessageKeyboardButton GetButton(Keyboard keyboard, long groupId)
        {
            KeyboardButtonColor color = KeyboardButtonColor.Default;

            switch (Color)
            {
            case ButtonColor.Blue:
                color = KeyboardButtonColor.Primary;
                break;

            case ButtonColor.Green:
                color = KeyboardButtonColor.Positive;
                break;

            case ButtonColor.Red:
                color = KeyboardButtonColor.Negative;
                break;
            }

            var action = new MessageKeyboardButtonAction()
            {
                Label = Label
            };

            switch (_buttonType)
            {
            case CallbackButtonType.Callback:
                action.Type = KeyboardButtonActionType.Callback;
                break;

            case CallbackButtonType.Text:
                action.Type = KeyboardButtonActionType.Text;
                break;
            }

            action.Payload = new KeyboardButtonPayload()
            {
                GroupId    = groupId,
                KeyboardId = keyboard.Id,
                ButtonId   = Id,
                Payload    = Payload
            }.Serialize();

            return(new MessageKeyboardButton()
            {
                Color = color, Action = action
            });
        }
コード例 #6
0
ファイル: Keyboards.cs プロジェクト: caisilus/sbornic_bot
        public static IKeyboardBuilder MainMenuKeyboardBuilder()
        {
            var buttonHelp = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Помощь",
                Payload = "{\"command\": \"help\"}",
            };
            var buttonTagsList = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Список тэгов",
                Payload = "{\"command\": \"tagsList\"}",
            };
            var buttonAddTag = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Добавить тэг",
                Payload = "{\"command\": \"addTag\"}"
            };
            var buttonAddPost = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Добавить пост",
                Payload = "{\"command\": \"addPost\"}"
            };
            var buttonAdmin = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Админ-панель",
                Payload = "{\"command\": \"adminPanel\"}"
            };
            IKeyboardBuilder keyboardBuilder = new KeyboardBuilder();

            keyboardBuilder.AddButton(buttonTagsList, KeyboardButtonColor.Positive);
            keyboardBuilder.AddButton(buttonAddTag, KeyboardButtonColor.Positive);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonAddPost, KeyboardButtonColor.Primary);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonAdmin, KeyboardButtonColor.Negative);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(buttonHelp, KeyboardButtonColor.Default);
            return(keyboardBuilder);
        }
コード例 #7
0
ファイル: Keyboards.cs プロジェクト: caisilus/sbornic_bot
        public static IKeyboardBuilder AcceptOrDeclineAdminKeyboardBuilder(long userId)
        {
            var buttonAccept = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Да",
                Payload = "{\"command\": \"acceptRemoveAdmin\", \"userId\": \"" + userId.ToString() + "\"}"
            };
            var buttonDecline = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Отмена",
                Payload = "{\"command\": \"declineRemoveAdmin\"}"
            };
            IKeyboardBuilder keyboardBuilder = new KeyboardBuilder();

            keyboardBuilder.SetInline();
            keyboardBuilder.AddButton(buttonAccept, KeyboardButtonColor.Positive);
            keyboardBuilder.AddButton(buttonDecline, KeyboardButtonColor.Negative);
            return(keyboardBuilder);
        }
コード例 #8
0
ファイル: Keyboards.cs プロジェクト: caisilus/sbornic_bot
        public static IKeyboardBuilder AcceptOrDeclineKeyboardBuilder()
        {
            var buttonAccept = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Да",
                Payload = "{\"command\": \"acceptSend\"}"
            };
            var buttonDecline = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Отмена",
                Payload = "{\"command\": \"declineSend\"}"
            };
            IKeyboardBuilder keyboardBuilder = new KeyboardBuilder();

            keyboardBuilder.SetInline();
            keyboardBuilder.AddButton(buttonAccept, KeyboardButtonColor.Positive);
            keyboardBuilder.AddButton(buttonDecline, KeyboardButtonColor.Negative);
            return(keyboardBuilder);
        }
コード例 #9
0
ファイル: Keyboards.cs プロジェクト: caisilus/sbornic_bot
        public static IKeyboardBuilder AdminPanelKeyboardBuilder()
        {
            var addAdmin = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Добавить админа",
                Payload = "{\"command\": \"addAdmin\"}",
            };
            var adminsList = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Список админов",
                Payload = "{\"command\": \"adminsList\"}",
            };
            var removeAdmin = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Убрать админа",
                Payload = "{\"command\": \"removeAdmin\"}",
            };
            var backToMain = new MessageKeyboardButtonAction()
            {
                Type    = KeyboardButtonActionType.Text,
                Label   = "Назад",
                Payload = "{\"command\": \"backToMain\"}",
            };
            IKeyboardBuilder keyboardBuilder = new KeyboardBuilder();

            keyboardBuilder.AddButton(addAdmin, KeyboardButtonColor.Positive);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(removeAdmin, KeyboardButtonColor.Negative);
            keyboardBuilder.AddButton(adminsList, KeyboardButtonColor.Primary);
            keyboardBuilder.AddLine();
            keyboardBuilder.AddButton(backToMain, KeyboardButtonColor.Negative);
            return(keyboardBuilder);
        }