Добавьте файлы проекта.
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
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 Newtonsoft.Json;
|
||||
using VkNet.Enums.Filters;
|
||||
using VkNet.Model.Attachments;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using SvetoforVKBot.Models.Dop;
|
||||
using SvetoforVKBot.Models.Commands;
|
||||
using System.Linq;
|
||||
|
||||
namespace SvetoforVKBot.Models.Commands.Registration
|
||||
{
|
||||
public class SelectParticipateCommand : Command
|
||||
{
|
||||
public override string Name => "{\"button\":\"selectParticipate\"}";
|
||||
|
||||
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);
|
||||
|
||||
List<MediaAttachment> listDoc = new List<MediaAttachment>()
|
||||
{
|
||||
new Document() { Id = 602601883, OwnerId = 59111081 } //59111081_600676073
|
||||
};
|
||||
|
||||
if (user.agree == 0)
|
||||
{
|
||||
switch (user.child)
|
||||
{
|
||||
case 0:
|
||||
@params.Message = "Вам уже исполнилось 18 лет? Исходя из возраста, мы сформируем для Вас подходящий документ " +
|
||||
"согласия на обработку персональных данных.\n\n" +
|
||||
"Нажмите кнопку на специальной клавиатуре👇";
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("Да", "selectChildAge-2", KeyboardButtonColor.Positive)
|
||||
.AddButton("Нет", "selectChildAge-1", KeyboardButtonColor.Negative)
|
||||
.AddLine()
|
||||
.AddButton("Назад", "startPL", KeyboardButtonColor.Default);
|
||||
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
return;
|
||||
|
||||
default:
|
||||
SelectAgreementCommand selectAgreement = new SelectAgreementCommand();
|
||||
selectAgreement.ExecutePL(update, client, db);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
user.tag = "Подписчик - Регистрация - Пол";
|
||||
db.SaveChanges();
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("М", "selectGender-1", KeyboardButtonColor.Primary)
|
||||
.AddButton("Ж", "selectGender-2", KeyboardButtonColor.Primary)
|
||||
.AddLine()
|
||||
.AddButton("Отменить", "startPL", KeyboardButtonColor.Default);
|
||||
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.UserId = chatId;
|
||||
@params.Message = //1 шаг из 4.
|
||||
"Выберите на клавиатуре внизу или напишите пол в формате \"М\" или \"Ж\"";
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
@params.Message = "Ошибка в SelectParticipateCommand: " + ee.Message;
|
||||
@params.Attachments = null;
|
||||
@params.Keyboard = null;
|
||||
@params.UserId = 59111081;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user