65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System;
|
||
using System.Data.SqlClient;
|
||
using SvetoforVKBot.Models.Updates;
|
||
using VkNet;
|
||
using VkNet.Enums.SafetyEnums;
|
||
using VkNet.Model.Keyboard;
|
||
using VkNet.Model.RequestParams;
|
||
using System.Text.RegularExpressions;
|
||
|
||
namespace SvetoforVKBot.Models.Commands.LK.Menu
|
||
{
|
||
public class SelectMenuCommand : Command
|
||
{
|
||
public override string Name => "{\"button\":\"selectMenu-";
|
||
|
||
public override void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
|
||
{
|
||
}
|
||
|
||
public override void ExecutePL(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
|
||
{
|
||
var chatId = update.@object.message.from_id;
|
||
MessagesSendParams @params = new MessagesSendParams();
|
||
Regex regex = new Regex("[^0-9]");
|
||
string msg = "";
|
||
var keyboardBuilder = new KeyboardBuilder().Clear();
|
||
try
|
||
{
|
||
string[] payload = update.@object.message.payload.Split('-');
|
||
int curSubMenu = Convert.ToInt32(regex.Replace(payload[1], ""));
|
||
|
||
@params.Message = "📅На какой день показать меню? Выберите на клавиатуре\n";
|
||
|
||
keyboardBuilder
|
||
.AddButton("Сегодня", "selectDayMenu-8", KeyboardButtonColor.Positive)
|
||
.AddLine()
|
||
.AddButton("Пн", "selectDayMenu-1", KeyboardButtonColor.Primary)
|
||
.AddButton("Вт", "selectDayMenu-2", KeyboardButtonColor.Primary)
|
||
.AddButton("Ср", "selectDayMenu-3", KeyboardButtonColor.Primary)
|
||
.AddLine()
|
||
.AddButton("Чт", "selectDayMenu-4", KeyboardButtonColor.Primary)
|
||
.AddButton("Пт", "selectDayMenu-5", KeyboardButtonColor.Primary)
|
||
.AddButton("Сб", "selectDayMenu-6", KeyboardButtonColor.Primary)
|
||
.AddLine()
|
||
.AddButton("Назад", "startPL", KeyboardButtonColor.Default);
|
||
|
||
//ShowMenuDostavka showMenuDostavka = new ShowMenuDostavka();
|
||
//showMenuDostavka.Execute(update, client, Con, msg, 2, curSubMenu);
|
||
@params.Keyboard = keyboardBuilder.Build();
|
||
@params.UserId = chatId;
|
||
@params.RandomId = GetRandomId();
|
||
client.Messages.SendAsync(@params);
|
||
}
|
||
catch (Exception ee)
|
||
{
|
||
@params.Message = "‼Ошибка в SelectMenuCommand: " + ee.Message;
|
||
@params.Attachments = null;
|
||
@params.Keyboard = null;
|
||
@params.UserId = 59111081;
|
||
@params.RandomId = GetRandomId();
|
||
client.Messages.SendAsync(@params);
|
||
}
|
||
}
|
||
}
|
||
} |