예제 #1
0
파일: bot.py 프로젝트: XrayT3/Kazbot
def send_all(message):
    head = "!!! Рассылка для всех пользователей !!!\n"
    tail = "\n---------------------------------------"
    try:
        if base.get_user_step(message.chat.id) == "Send":
            file_info = bot.get_file(message.photo[-1].file_id)
            downloaded_file = bot.download_file(file_info.file_path)
            with open("temp.jpg", 'wb+') as new_file:
                new_file.write(downloaded_file)
            for id in base.get_all_ids():
                bot.send_message(id, head)
                bot.send_photo(message.chat.id, photo=open("temp.jpg", 'rb'))

            bot.send_message(message.chat.id, "Ваша рассылка отправлена!", reply_markup=markups.admin())
    except:
        for id in base.get_all_ids():
            bot.send_message(id, head + message.text + tail)
        bot.send_message(message.chat.id, "Ваша рассылка отправлена!", reply_markup=markups.admin())
예제 #2
0
def start(message):
    sent = bot.send_message(message.chat.id,
                            const.welcome_msg,
                            reply_markup=markups.admin(message.chat.id))
    bot.register_next_step_handler(sent, reply_msg)
예제 #3
0
파일: bot.py 프로젝트: XrayT3/Kazbot
def admin(message):
    if not base.is_admin(message.chat.id):
        bot.send_message(message.chat.id, "Нет прав доступа")
    else:
        bot.send_message(message.chat.id, "Админ-панель",
                         reply_markup=markups.admin())
예제 #4
0
파일: bot.py 프로젝트: XrayT3/Kazbot
def admin(call):
    bot.edit_message_text("Админ-панель", chat_id=call.message.chat.id, message_id=call.message.message_id)
    bot.edit_message_reply_markup(chat_id=call.message.chat.id, message_id=call.message.message_id,
                                  reply_markup=markups.admin())
예제 #5
0
파일: bot.py 프로젝트: XrayT3/Kazbot
def statistics(call):
    msg = "Всего продавцов: {clients}\nВсего покупателей: {users}".format(clients = base.count_clients(), users = base.count_users())
    bot.edit_message_text(msg, chat_id=call.message.chat.id, message_id=call.message.message_id)
    bot.edit_message_reply_markup(chat_id=call.message.chat.id, message_id=call.message.message_id,
                                  reply_markup=markups.admin())