def delete_answer_step1(message, bot): chat_id = message.chat.id func.delete_answer(message.text) bot.send_message(chat_id, "Вопрос удален") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())
def delete_withdraw(call, bot, user_data): bot.send_message(user_data, "Ваша выплата удалена") bot.send_message(call.message.chat.id, "Вы подтвердили данную заявку на вывод") bot.send_message(call.message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb()) func.delete_withdraw(user_data)
def add_answer_step2(message, bot, quetion): chat_id = message.chat.id hash = random.randint(1000000000000, 999999999999999) answer = message.text func.create_answer(hash, quetion, answer) bot.send_message(chat_id, "Вопрос создан") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())
def delete_quetion(call, bot, user_data): chat_id = call.message.chat.id quetion = func.get_last_quetion() username = bot.get_chat(quetion[0]).username func.delete_quetion(quetion[0]) bot.send_message(quetion[0], "Ваш запрос в поддержку был удален") bot.send_message(chat_id, f"Вы удалили вопрос от @{username}") bot.send_message(call.message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())
def unban_user_step1(message, bot): try: chat_id = message.chat.id Id = int(message.text) func.delete_user_from_ban(Id) usrname = bot.get_chat(Id).username bot.send_message(chat_id, f"Пользователь @{usrname} разблокирован") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb()) except: error_message(message, bot)
def get_last_message_support(call, bot, user_data): chat_id = call.message.chat.id quetion = func.get_last_quetion() if quetion != 0: username = bot.get_chat(quetion[0]).username bot.send_message(chat_id, f"Вопрос от @{username}\n\nСам вопрос {quetion[1]}", reply_markup=menu.answer_quetion_support(quetion[0])) else: bot.send_message(chat_id, "Вопросов нет") bot.send_message(call.message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())
def delete_non_true_user_step1(message, bot): try: chat_id = message.chat.id Id = message.text func.delete_non_true_user(Id) username = bot.get_chat(Id).username bot.send_message( chat_id, f"Теперь пользователь @{username} не будет выигрывать") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb()) except: error_message(message, bot)
def update_user_balanse_step2(message, bot, Id): try: sum_update = float(message.text) chat_id = message.chat.id func.update_user_balanse(Id, sum_update) usrname = bot.get_chat(Id).username bot.send_message( chat_id, f"Баланс пользователя @{usrname} Равен {sum_update} RUB") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb()) except: error_message(message, bot)
def answer_quetion_step1(message, bot, user_id): chat_id = message.chat.id answer = message.text quetion = func.get_last_quetion() func.delete_quetion(quetion[0]) username = bot.get_chat(quetion[0]).username bot.send_message( quetion[0], f"На ваш вопрос в поддержку был дан ответ\n\nВопрос:{quetion[1]}\n\nОтвет:{answer}" ) bot.send_message(chat_id, f"Вы ответили на вопрос вопрос от @{username}") bot.send_message(message.chat.id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())
def send_messages_all_users_step1(message, bot): chat_id = message.chat.id Users = func.get_all_users_inform() Count = 0 try: for i in Users: i = i[0] Count = Count + 1 if message.text != None: bot.send_message(i, message.text) elif message.photo != None: try: file_info = bot.get_file(message.photo[len(message.photo) - 1].file_id) downloaded_file = bot.download_file(file_info.file_path) src = file_info.file_path with open(src, 'wb') as new_file: new_file.write(downloaded_file) except Exception as e: bot.reply_to(message, e) with open(src, 'rb') as f: contents = f.read() if message.caption != None: C = message.caption bot.send_photo(i, contents, caption=C) else: bot.send_photo(i, contents) elif message.video != None: try: file_info = bot.get_file(message.video.file_id) downloaded_file = bot.download_file(file_info.file_path) src = file_info.file_path with open(src, 'wb') as new_file: new_file.write(downloaded_file) except Exception as e: bot.reply_to(message, e) with open(src, 'rb') as f: contents = f.read() if message.caption != None: C = message.caption bot.send_video(i, contents, caption=C) else: bot.send_video(i, contents) except: error_message(message) bot.send_message(chat_id, "Сообщение отправлено " + str(Count) + " пользователям") bot.send_message(chat_id, "Добро пожаловать в меню администратора", reply_markup=menu.gen_admin_kb())