Files
Parasha/SvetoforVKBot/Models/Commands/LK/Consultation/SelectConsultationCommand.cs
2021-10-19 06:04:52 +03:00

62 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Newtonsoft.Json;
using SvetoforVKBot.Models.Updates;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using VkNet;
using VkNet.Enums.SafetyEnums;
using VkNet.Model.Attachments;
using VkNet.Model.Keyboard;
using VkNet.Model.RequestParams;
namespace SvetoforVKBot.Models.Commands.LK.Consultation
{
public class SelectConsultationCommand : Command
{
public override string Name => "{\"button\":\"selectConsultation\"}";
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();
var keyboardBuilder = new KeyboardBuilder().Clear();
try
{
var user = db.Users.Single(usr => usr.chatId == chatId);
user.tag = "Консультация - Вопрос";
db.SaveChanges();
@params.Message = //"Вы можете записаться на онлайн-консультацию к специалисту.\n" +
"Напишите свой вопрос сюда одним сообщением. " + //Это будет служить Вашей заявкой.\n" +
"Менеджер свяжется с Вами для ответа и уточнения информации."; //"Мы оповестим Вас о ближайшей консультации, к которой Вы сможете присоединиться.\n\n";
keyboardBuilder
.AddButton("Назад", "startPL", KeyboardButtonColor.Default);
@params.Keyboard = keyboardBuilder.Build();
@params.UserId = chatId;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
catch (Exception ee)
{
@params.Message = "Ошибка в SelectExpertLKCommand: " + ee.Message;
@params.Attachments = null;
@params.Keyboard = null;
@params.UserId = 59111081;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
}
}
}