Добавьте файлы проекта.

This commit is contained in:
Daria
2021-10-19 06:04:52 +03:00
parent 6ee25d0f59
commit eab3081ec2
187 changed files with 100839 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
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);
}
}
}
}