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

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,100 @@
using SvetoforVKBot.Models.Updates;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using VkNet;
using VkNet.Model.Keyboard;
using VkNet.Model.RequestParams;
using VkNet.Enums.SafetyEnums;
using System.Text.RegularExpressions;
using System.Linq;
namespace SvetoforVKBot.Models.Commands
{
public class SelectRoleCommand : Command
{
public override string Name => "{\"button\":\"selectRole-";
public override void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
}
public override void ExecutePL(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
MessagesSendParams @params = new MessagesSendParams();
var chatId = update.@object.message.from_id;
Regex regex = new Regex("[^0-9]");
var keyboardBuilder = new KeyboardBuilder().Clear();
try
{
string[] payload = update.@object.message.payload.Split('-');
int role = Convert.ToInt32(regex.Replace(payload[1], ""));
string btnPL = "";
//Роли нет в текущем составе атрибутов пользователя
//SqlCommand updRole = new SqlCommand("UPDATE Users SET role = @role WHERE chatId = @chatId;", Con);
//updRole.Parameters.AddWithValue("@chatId", chatId);
//updRole.Parameters.AddWithValue("@role", 0);
//updRole.ExecuteNonQuery();
switch (role)
{
case 1:
@params.Message = "Становясь участником, ты открываешь для себя возможности:\n\n" +
"✅ найти в себе уникальную и талантливую личность\n" +
"✅ развивать только нужные скиллы\n" +
"✅ найти новых друзей и увлекательные ивенты\n" +
"✅ выбрать наставника и вместе прокачивать навыки";
btnPL = "selectStudentRegistration";
break;
case 2:
@params.Message = "В разработке";
btnPL = "selectCoachRegistration";
break;
case 3:
@params.Message = "В разработке";
btnPL = "selectPartnerRegistration";
break;
case 4:
@params.Message = "В разработке";
btnPL = "selectPartnerRegistration";
break;
case 5:
@params.Message = "В разработке";
btnPL = "selectPartnerRegistration";
break;
}
keyboardBuilder
.AddButton("Продолжить регистрацию", btnPL, KeyboardButtonColor.Positive)
.AddLine()
.AddButton("Назад", "startPL", KeyboardButtonColor.Default);
@params.Keyboard = keyboardBuilder.Build();
@params.UserId = chatId;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
catch (Exception ee)
{
@params.Message = "‼Ошибка в SelectRoleCommand: " + ee.Message;
@params.Attachments = null;
@params.Keyboard = null;
@params.UserId = 59111081;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
}
}
}