Example #1
0
        public override async void Execute(TelegramBotClient botClient, System.Object message)
        {
            CallbackQuery _message = message as CallbackQuery;
            DataBase      db       = Singleton.GetInstance().Context;

            BotCore.InlineButton inlineButton = new BotCore.InlineButton();
            try
            {
                if (IsBan.Ban(botClient, message))
                {
                    User user = db.GetUser(_message.From.Id);
                    if (IsNullDataBase.IsNull(botClient, _message, user))
                    {
                        return;
                    }
                    System.String temp = InfoUser.Info(user);
                    if (user.IsAdmin == 0)
                    {
                        await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId, temp,
                                                             Telegram.Bot.Types.Enums.ParseMode.Html,
                                                             replyMarkup : inlineButton.Accaunt);
                    }
                    else
                    {
                        await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId, temp,
                                                             Telegram.Bot.Types.Enums.ParseMode.Html,
                                                             replyMarkup : inlineButton.AdminAccaunt);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Log.Logging(ex);
            }
        }
Example #2
0
        internal void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))
            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            User userTwo = SearchUser(_message);

            botClient.DeleteMessage(_message.Chat.Id, _message.MessageId, "33 - AddUserInTransaction");

            if (userTwo != null)
            {
                Transaction transaction = db.GetTransaction(user);
                transaction.AddUser = false;
                user.Chain          = (Int32)SetChain.MessageUserInBot;
                db.Save();

                botClient.EditMessage(_message.From.Id, user.MessageID, "Ожидайте пока участник подтвердить действие.", "45 - AddUserInTransaction", user, replyMarkup: InlineButtonBlockchain.GuarantorMeinMenu(user));

                String text = $"✅Подтвердить✅\nОтправитель: {transaction.UserSender.FIO}\nКомиссия: ";
                text += transaction.WhoCommissionPay == true ? "получатель" : "отправитель";
                text += $"\nСумма: {transaction.SumPayNew}\nВалюта: ";
                text += transaction.PaymentId == 1 ? "BTC" : transaction.PaymentId == 2 ? "USDT" : transaction.PaymentId == 3 ? "Ethereum" : transaction.PaymentId == 4 ? "Ripple" : "не выбрана!";

                botClient.SendText(userTwo.ID, text, userTwo, replyMarkup: InlineButtonBlockchain.ConfirmOrCancelThisTransactionUserTwo(transaction));
            }
        }
Example #3
0
        public override async void Execute(TelegramBotClient botClient, System.Object message)
        {
            CallbackQuery _message = message as CallbackQuery;
            DataBase      db       = Singleton.GetInstance().Context;
            await Task.Run(() => DeleteMessage(botClient, _message));

            try
            {
                if (IsBan.Ban(botClient, message))
                {
                    User user = db.GetUser(_message.From.Id);
                    if (IsNullDataBase.IsNull(botClient, _message, user))
                    {
                        return;
                    }
                    AdUser adUser = db.GetAdUser(user.ID);
                    adUser.EditingPostTemplateId = -1;
                    db.Save();
                    InlineKeyboardMarkup answer = InlineButton.GetAdvertising(user);
                    await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId,
                                                         "📞Ваша реклама📞", Telegram.Bot.Types.Enums.ParseMode.Html,
                                                         replyMarkup : answer);
                }
            }
            catch (System.Exception ex)
            {
                Log.Logging(ex);
            }
        }
Example #4
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            if (user.IsAdmin >= 2)
            {
                Category category = db.GetCategory(_message.Text);
                if (category == null)
                {
                    return;
                }

                db._categories.Remove(category);
                db.Save();


                BotCore.InlineButton inlineButton = new BotCore.InlineButton();
                botClient.DeleteMessage(_message.From.Id, _message.MessageId, "295 - ThisDeleteCategory");
                botClient.EditMessage(_message.From.Id, user.MessageID, "Категория была удалена!", "295 - ThisDeleteCategory", user, replyMarkup: inlineButton.SettingBotLvl2(user));
            }
        }
Example #5
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))
            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            AdUser       adUser       = db.GetAdUser(user.ID);
            PostTemplate postTemplate = db.GetTempalte(adUser.User.ID, adUser.EditingPostTemplateId);

            try
            {
                AdController.SetContent(botClient, postTemplate, _message, adUser.Order);
                botClient.DeleteMessage(_message.From.Id, _message.MessageId, "78 - AddPhoto ChainAnaliz");
                botClient.DeleteMessage(_message.From.Id, _message.MessageId - 1, "79 - AddPhoto ChainAnaliz");
                botClient.SendText(_message.From.Id, "Управление шаблоном\n1. Заполните контент\n2. Введите время постинга.\n3. Выберете чат(ы)\n4. Отправьте на проверку администрации.", user, replyMarkup: InlineButton.ContentKeyboard(postTemplate, true));
                user.Chain = (System.Int32)SetChain.MessageUserInBot;
                db.Save();
            }
            catch (System.Exception ex)
            {
                Log.Logging(ex);
            }
            db.Save();
        }
        public override void Execute(TelegramBotClient botClient, System.Object message)
        {
            IStandartCommand standartCommand = new CancelMyTransaction();
            ITransaction     transaction     = new CancelMyTransaction();
            ISplitName       splitName       = new CancelMyTransaction();

            if (standartCommand.SetCallbackQuery(message, out _message))
            {
                return;
            }

            if (standartCommand.SetDataBase(out db))
            {
                return;
            }

            if (standartCommand.SetUserAndCheckIsNull(botClient, _message, out user, db))
            {
                return;
            }

            SetUser();

            if (user.ID == userAdmin.ID)
            {
                SetSettings();
                if (IsNullDataBase.IsNull(botClient, _message, settings))
                {
                    return;
                }

                Int32 IdTransaction = splitName.GetNameSplit(Name);
                Name = CommandTextBlockchain.GetMoneySenderAdminInBlockChain;

                if (transaction.GetTransaction(out this.transaction, IdTransaction, db))
                {
                    return;
                }

                ChangeTransaction();

                if (CheckTransaction())
                {
                    PaySender();
                }

                SendMessage(botClient);

                DeleteMessage(botClient);
            }
        }
Example #7
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            if (user.IsAdmin >= 2)
            {
                Settings settings = db.GetSettings();
                settings.Regulations = _message.Text;
                db.Save();
                BotCore.InlineButton inlineButton = new BotCore.InlineButton();
                botClient.DeleteMessage(_message.From.Id, _message.MessageId, "172 - ThisRegulationsUBC");
                botClient.EditMessage(_message.From.Id, user.MessageID, "Ссылка на правила была изменена!", "173 - ThisRegulationsUBC", user, replyMarkup: inlineButton.SettingBotLvl2(user));
            }
        }
Example #8
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            try
            {
                await botClient.DeleteMessageAsync(_message.From.Id, _message.MessageId);

                await botClient.DeleteMessageAsync(_message.From.Id, user.MessageID);

                System.Int32 payment = 0;
                System.Int32.TryParse(_message.Text, out payment);

                if (payment == 0)
                {
                    await botClient.SendTextMessageAsync(_message.From.Id, "Вы ввели не верный формат! \nПожалуйста введите еще раз сумму оплаты: (грн)", replyMarkup : InlineButton.BackToAdvertisingMenu);
                }
                else
                {
                    await botClient.SendInvoiceAsync(
                        chatId : _message.From.Id,
                        title : "Пополнение баланса на: " + _message.Text + " грн",
                        description : "Пополнение баланса на: " + _message.Text + " грн",
                        payload : "Balance is correct",
                        providerToken : "635983722:LIVE:i29496402528",
                        startParameter : "HEllo",
                        currency : "UAH",
                        prices : new[] { new LabeledPrice("price", payment * 100), },
                        replyMarkup : InlineButton.Payment
                        );

                    user.Chain = (System.Int32)SetChain.MessageUserInBot;
                }                //
                db.Save();
            }
            catch { }
            db.Save();
        }
        public override System.Object Handle(System.Int32 request, TelegramBotClient botClient, System.Object message)
        {
            if (request == (System.Int32)SetChain.SetTransactionDiscription || request == (System.Int32)SetChain.SetTransactionDiscriptionUSerTwo)
            {
                Message _message = message as Message;
                db = Singleton.GetInstance().Context;

                user = db.GetUser(_message.From.Id);
                if (IsNullDataBase.IsNull(botClient, _message, user))
                {
                    return(null);
                }

                if (request == (System.Int32)SetChain.SetTransactionDiscription)
                {
                    transaction = db.GetTransaction(user);
                }
                else
                {
                    transaction = db.GetTransactionUserRecipient(user);
                }
                if (IsNullDataBase.IsNull(botClient, _message, transaction))
                {
                    return(null);
                }

                ChangeTransaction(_message, request);

                ChangeUserChanin();

                SendMessage(botClient, _message, request);

                PaySender(botClient, _message);

                return(null);
            }
            else
            {
                return(base.Handle(request, botClient, message));
            }
        }
Example #10
0
        internal void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            botClient.DeleteMessage(_message.Chat.Id, _message.MessageId, "33 - AddUserInTransaction");

            botClient.EditMessage(_message.From.Id, user.MessageID, "Ваша заявка была отправлена администраторам, ожидайте в ближайшее время с вами свяжутся!", "45 - AddUserInTransaction", user, replyMarkup: InlineButtonBlockchain.GuarantorMeinMenu(user));

            String temp = $"Помощь по гаранту\n🆔: {user.ID}\n🖌ФИО: {user.FIO}\n📱Номер: {user.Number}\n";

            temp += user.Username != "Нет!" ? "🧸Юзернейм: @" + user.Username : "";
            temp += $"\nСообщение: \n{_message.Text}";

            Settings settings = db.GetSettings();

            botClient.SendText(settings.ChannelAdmin, temp);
        }
Example #11
0
        public override async void Execute(TelegramBotClient botClient, System.Object message)
        {
            CallbackQuery _message = message as CallbackQuery;
            DataBase      db       = Singleton.GetInstance().Context;

            try
            {
                if (IsBan.Ban(botClient, message))
                {
                    AdUser adUser = db.GetAdUser(_message.From.Id);
                    if (IsNullDataBase.IsNull(botClient, _message, adUser))
                    {
                        return;
                    }
                    await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId, "Ваш баланс: " + adUser.Balance + " грн", replyMarkup : InlineButton.Balance);
                }
            }
            catch (System.Exception ex)
            {
                Log.Logging(ex);
            }
        }
Example #12
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;
            }

            if (user.IsAdmin >= 2)
            {
                Channel channel = db.GetChannel(_message.Text);
                if (channel == null)
                {
                    return;
                }

                TMessage[] messages = db.GetTMessages();

                foreach (TMessage item in messages)
                {
                    if (item.channel != null)
                    {
                        if (item.channel.IDChannel == channel.IDChannel)
                        {
                            db._tmessage.Remove(item);
                        }
                    }
                }
                Delete(db, channel);
                db._channels.Remove(channel);
                db.Save();

                BotCore.InlineButton inlineButton = new BotCore.InlineButton();
                botClient.DeleteMessage(_message.From.Id, _message.MessageId, "208 - ThisDeleteChat");
                botClient.EditMessage(_message.From.Id, user.MessageID, "Чат был успешно удаляен! Не забудьте удалить бота их чата!", "209 - ThisDeleteChat", user, replyMarkup: inlineButton.SettingBotLvl2(user));
            }
        }
        public override async void Execute(TelegramBotClient botClient, System.Object message)
        {
            CallbackQuery _message = message as CallbackQuery;
            DataBase      db       = Singleton.GetInstance().Context;

            User user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))

            {
                return;
            }

            if (IsBan.Ban(botClient, message))
            {
                if (user.IsAdmin >= 2)
                {
                    try
                    {
                        await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId, "Реклама", replyMarkup : InlineButton.AdvertisingShowAdmin);
                    }
                    catch (System.Exception ex)
                    {
                        Log.Logging(ex);
                    }
                }
                else
                {
                    try
                    {
                        await botClient.EditMessageTextAsync(_message.From.Id, _message.Message.MessageId, "Реклама", replyMarkup : InlineButton.AdvertisingShow);
                    }
                    catch (System.Exception ex)
                    {
                        Log.Logging(ex);
                    }
                }
            }
        }
Example #14
0
        public override System.Object Handle(System.Int32 request, TelegramBotClient botClient, System.Object message)
        {
            if (request == (System.Int32)SetChain.SetIdTransaction)
            {
                _message = message as Message;
                db       = Singleton.GetInstance().Context;

                user = db.GetUser(_message.From.Id);
                if (IsNullDataBase.IsNull(botClient, _message, user))
                {
                    return(null);
                }

                transaction = db.GetTransaction(user);
                if (IsNullDataBase.IsNull(botClient, _message, transaction))
                {
                    return(null);
                }

                ChangeUserChanin();

                if (!CheckIdTransaction(botClient).Result)
                {
                    return(null);
                }

                SendMessage(botClient, _message);

                Task.Run(() => SetIncomeChannel(botClient));

                return(null);
            }
            else
            {
                return(base.Handle(request, botClient, message));
            }
        }
Example #15
0
        internal async void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db   = Singleton.GetInstance().Context;
            User     user = db.GetUser(_message.From.Id); if (IsNullDataBase.IsNull(botClient, _message, user))
            {
                return;                                                                                                         // - заменить на другую таблицу
            }
            AdUser       adUser       = db.GetAdUser(user.ID);
            PostTemplate postTemplate = db.GetTempalte(adUser.User.ID, adUser.EditingPostTemplateId);

            try
            {
                AdController.SetContent(botClient, postTemplate, _message, 0);

                Int32 len = _message.Text.Length;

                if (len > 20)
                {
                    len = 20;
                }

                String str = new String(_message.Text.ToCharArray(), 0, len - 1);

                postTemplate.Name = _message.Text;
                await botClient.DeleteMessageAsync(_message.From.Id, _message.MessageId);

                await botClient.EditMessageTextAsync(_message.From.Id, user.MessageID, "Управление шаблоном\n1. Заполните контент\n2. Введите время постинга.\n3. Выберете чат(ы)\n4. Отправите на проверку администрации.", replyMarkup : InlineButton.ContentKeyboard(postTemplate, true));

                user.Chain = (System.Int32)SetChain.MessageUserInBot;
                db.Save();
            }
            catch (System.Exception ex)
            {
                Log.Logging(ex);
            }
            db.Save();
        }
Example #16
0
        public override System.Object Handle(System.Int32 request, TelegramBotClient botClient, System.Object message)
        {
            if (request == (System.Int32)SetChain.SetPayTransaction)
            {
                Message _message = message as Message;
                db = Singleton.GetInstance().Context;

                user = db.GetUser(_message.From.Id);
                if (IsNullDataBase.IsNull(botClient, _message, user))
                {
                    return(null);
                }

                transaction = db.GetTransaction(user);
                if (IsNullDataBase.IsNull(botClient, _message, transaction))
                {
                    return(null);
                }

                if (!SelectChangePay(botClient, _message))
                {
                    ChangeTransactionAndUser();
                    return(null);
                }

                ChangeUserChanin();

                SendMessage(botClient, _message);

                return(null);
            }
            else
            {
                return(base.Handle(request, botClient, message));
            }
        }