示例#1
0
        public override void ExecutePL(RootObject update, VkApi client, SqlConnection Con)
        {
            var chatId = [email protected]_id;
            MessagesSendParams @params = new MessagesSendParams();

            try
            {
                ShowWorld showWorld = new ShowWorld();
                showWorld.Execute(update, client, Con);
            }
            catch (Exception ee)
            {
                @params.Message     = "Ошибка в SelectBackCommand: " + ee.Message;
                @params.Attachments = null;
                @params.Keyboard    = null;
                @params.UserId      = 59111081;
                @params.RandomId    = GetRandomId();
                client.Messages.SendAsync(@params);
            }
        }
        public override void ExecutePL(RootObject update, VkApi client, SqlConnection Con)
        {
            MessagesSendParams @params = new MessagesSendParams();
            var chatId = [email protected]_id;

            var   keyboardBuilder = new KeyboardBuilder().Clear();
            Regex regex           = new Regex("[^0-9]");

            try
            {
                //var ids = new long[] { chatId };
                //var user = client.Users.Get(ids);

                //TO DO: switch-case role

                SqlCommand editUser = new SqlCommand("UPDATE Users SET study = @study, state = @state, tag = @tag, health = @health, " +
                                                     "experience = @experience, gold = @gold WHERE chatId = @chatId;", Con);
                editUser.Parameters.AddWithValue("@chatId", chatId);
                editUser.Parameters.AddWithValue("@study", 1);
                editUser.Parameters.AddWithValue("@state", 1);
                editUser.Parameters.AddWithValue("@experience", 0);
                editUser.Parameters.AddWithValue("@gold", 150);
                editUser.Parameters.AddWithValue("@health", 0);
                editUser.Parameters.AddWithValue("@tag", "Новичок - Обучение");
                editUser.ExecuteNonQuery();

                ShowWorld showWorld = new ShowWorld();
                showWorld.Execute(update, client, Con);
            }
            catch (Exception ee)
            {
                @params.Message     = "‼Ошибка в SelectEducationCommand: " + ee.Message;
                @params.Attachments = null;
                @params.Keyboard    = null;
                @params.UserId      = 59111081;
                @params.RandomId    = GetRandomId();
                client.Messages.SendAsync(@params);
            }
        }