Beispiel #1
0
Datei: bot.py Projekt: mmdaz/Bot
def get_date_day(bot, update):
    day = update.get_effective_message().text
    dispatcher.set_conversation_data(update, "day", day)
    user_peer = update.get_effective_user()
    if not (
        (0 < int(day) < 32
         and 0 < int(dispatcher.get_conversation_data(update, "month")) < 7) or
        (0 < int(day) < 31
         and 6 < int(dispatcher.get_conversation_data(update, "month")) < 13)):
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_day),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        bot.send_message(TemplateMessage(Message.GET_ALARM_HOUR, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_hour),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #2
0
Datei: bot.py Projekt: mmdaz/Bot
def get_date_minute(bot, update):
    minute = update.get_effective_message().text
    dispatcher.set_conversation_data(update, "minute", minute)
    user_peer = update.get_effective_user()
    if not 0 <= int(minute) < 60:
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_minute),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        # print(create_time(year, month, day, hour, minute))
        dispatcher.get_conversation_data(
            update, "alarm").start_time = create_time(
                dispatcher.get_conversation_data(update, "year"),
                dispatcher.get_conversation_data(update, "month"),
                dispatcher.get_conversation_data(update, "day"),
                dispatcher.get_conversation_data(update, "hour"),
                dispatcher.get_conversation_data(update, "minute"))
        bot.send_message(TemplateMessage(Message.GET_ALARM_REPETITION_PERIOD,
                                         button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), finish_creating_alarm),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #3
0
Datei: bot.py Projekt: mmdaz/Bot
def get_date_year(bot, update):
    user_peer = update.get_effective_user()
    year = update.get_effective_message().text
    dispatcher.set_conversation_data(update, "year", year)
    if int(year) < 1397:
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_year),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
        print("salammmmmmmmmmmmmmmmmmmmmmmmmm")

    else:
        bot.send_message(TemplateMessage(Message.GET_ALARM_MONTH, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_month),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #4
0
Datei: bot.py Projekt: mmdaz/Bot
def get_debt_date_month(bot, update):
    user_peer = update.get_effective_user()
    debt_month = update.get_effective_message()
    dispatcher.set_conversation_data(update, "debt_month", debt_month.text)
    if not (0 < int(debt_month.text) < 13):
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_debt_date_month),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        bot.send_message(TemplateMessage(Message.GET_DEBT_DAY, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_debt_date_day),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #5
0
Datei: bot.py Projekt: mmdaz/Bot
def get_alarm_stop_message(bot, update):
    user_peer = update.get_effective_user()
    alarm_stop_message = update.get_effective_message()
    if check_stop_message_repetition(user_peer.get_json_str(),
                                     alarm_stop_message.text):
        bot.send_message(TemplateMessage(Message.STOP_MESSAGE_REPETIOTION,
                                         button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_alarm_stop_message),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        dispatcher.get_conversation_data(
            update, "alarm").stop_message = alarm_stop_message.text
        bot.send_message(TemplateMessage(Message.GET_ALARM_PHOTO, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(PhotoFilter(), get_alarm_photo),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #6
0
Datei: bot.py Projekt: mmdaz/Bot
def start_bot(bot, update):
    user_peer = update.get_effective_user()
    input = update.get_effective_message()
    print(input.text)
    btn_list = [
        TemplateMessageButton("ساختن هشدار جدید ", "/create_alarm", 0),
        TemplateMessageButton("اضافه کردن بدهی ", "/add_debt", 0),
        TemplateMessageButton("گرفتن فایل اکسل صورتحساب ها  ", "/get_excel", 0)
    ]
    temlate_message = TemplateMessage(
        general_message=Message.START_BOT_MESSAGE, btn_list=btn_list)
    bot.send_message(temlate_message,
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TemplateResponseFilter(keywords=["/create_alarm"]),
                       start_creating_alarm),
        MessageHandler(TemplateResponseFilter(keywords=["/add_debt"]),
                       start_get_debt_conversation),
        MessageHandler(TemplateResponseFilter(keywords=["/get_excel"]),
                       send_excel_report),
        MessageHandler(TextFilter(keywords=["/start"]), start_bot),
        MessageHandler(TemplateResponseFilter(keywords=["/start"]), start_bot)
    ])
Beispiel #7
0
Datei: bot.py Projekt: mmdaz/Bot
def get_debt_date_day(bot, update):
    user_peer = update.get_effective_user()
    debt_day = update.get_effective_message()
    dispatcher.set_conversation_data(update, "debt_day", debt_day.text)
    if not ((0 < int(debt_day.text) < 32 and 0 < int(
            dispatcher.get_conversation_data(update, "debt_month")) < 7) or
            (0 < int(debt_day.text) < 31 and 6 < int(
                dispatcher.get_conversation_data(update, "debt_month")) < 13)):
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_debt_date_day),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        dispatcher.get_conversation_data(
            update, "debt").date = "{}:{}:{}".format(
                dispatcher.get_conversation_data(update, "debt_year"),
                dispatcher.get_conversation_data(update, "debt_month"),
                dispatcher.get_conversation_data(update, "debt_day"))
        print(dispatcher.get_conversation_data(update, "debt").user_id)
        bot.send_message(TemplateMessage(Message.GET_DEBT_PHOTO, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(PhotoFilter(), get_debt_photo),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
Beispiel #8
0
    def initiate_search_officers(self, bot, update):
        self.handlers.extend(self.dispatcher.message_handlers)
        user = update.get_effective_user()
        message = TemplateMessage(
            TextMessage(ConstantMessage.officer_search_criterion), [
                TemplateMessageButton(ButtonMessage.all_officers),
                TemplateMessageButton(ButtonMessage.main_menu_message)
            ])
        self.send_message(bot, update, message, user,
                          sys._getframe().f_code.co_name)
        self.handlers.extend([
            MessageHandler(
                TemplateResponseFilter(keywords=[ButtonMessage.all_officers]),
                self.handle_customer_criterion_input),
            MessageHandler(
                TemplateResponseFilter(
                    keywords=[ButtonMessage.main_menu_message]),
                self.show_menu),
        ])

        # TODO: This seems odd to me to add two lists, find a better way if possible
        self.dispatcher.register_conversation_next_step_handler(
            update, self.handlers + [
                MessageHandler(TextFilter(),
                               self.handle_customer_criterion_input)
            ])
Beispiel #9
0
Datei: bot.py Projekt: mmdaz/Bot
def get_date_hour(bot, update):
    hour = update.get_effective_message().text
    dispatcher.set_conversation_data(update, "hour", hour)
    user_peer = update.get_effective_user()
    if not 0 <= int(hour) < 24:
        bot.send_message(TemplateMessage(Message.INVALID_INPUT, button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_hour),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
    else:
        bot.send_message(TemplateMessage(Message.GET_ALARM_MINUTE,
                                         button_list),
                         user_peer,
                         success_callback=success,
                         failure_callback=failure)
        dispatcher.register_conversation_next_step_handler(
            update, [
                MessageHandler(TextFilter(), get_date_minute),
                MessageHandler(TemplateResponseFilter(keywords="/start"),
                               start_bot)
            ])
def request_money_changer(bot, update):
    user_peer = update.get_effective_user()
    sender_name = update.get_effective_message().text
    dispatcher.set_conversation_data(update,
                                     key="sender_name",
                                     value=sender_name)
    money_changers = select_ready_money_changers()
    buttons_list, keywords = get_buttons_from_money_changers(money_changers)
    if buttons_list:
        buttons_list += [BotButtons.back_to_main_menu]
        template_message = TemplateMessage(
            TextMessage(BotTexts.choose_one_money_changer), buttons_list)
        send_message(message=template_message,
                     peer=user_peer,
                     step=Step.request_money_changer)
        dispatcher.register_conversation_next_step_handler(
            update,
            handlers=common_handlers + [
                MessageHandler(TemplateResponseFilter(keywords=keywords),
                               request_province)
            ])
    else:
        buttons_list += [BotButtons.back_to_main_menu]
        template_message = TemplateMessage(
            TextMessage(BotTexts.no_money_changer_found), buttons_list)
        send_message(message=template_message,
                     peer=user_peer,
                     step=Step.request_money_changer)
        dispatcher.finish_conversation(update)
def show_current_money_branches(bot, update):
    user_peer = update.get_effective_user()
    money_changer = select_money_changer_by_peer_id(user_peer.peer_id)
    branches = select_branches_by_money_changer_id(
        money_changer_id=money_changer.id)
    dispatcher.set_conversation_data(update, "branches", branches)
    if branches:
        branches_buttons, keywords = get_template_buttons_from_branches(
            branches)
        template_message = TemplateMessage(
            TextMessage(BotTexts.choose_branch_for_remove), branches_buttons)
        send_message(message=template_message,
                     peer=user_peer,
                     step=Step.request_province_name)
        dispatcher.register_conversation_next_step_handler(
            update,
            handlers=common_handlers + [
                MessageHandler(TemplateResponseFilter(keywords=keywords),
                               remove_money_branch)
            ])
    else:
        buttons_list = [BotButtons.back_to_main_menu]
        template_message = TemplateMessage(
            TextMessage(BotTexts.no_branches_found), buttons_list)
        send_message(message=template_message,
                     peer=user_peer,
                     step=Step.request_province_name)
        dispatcher.finish_conversation(update)
Beispiel #12
0
 def __init__(self, dispatcher):
     self.dispatcher = dispatcher
     self.handlers = [
         MessageHandler(
             TemplateResponseFilter(ButtonMessage.officer_score_message),
             self.officer_score_initial_state)
     ]
def user_panel(bot, update):
    user_peer = update.get_effective_user()
    buttons_list = [BotButtons.remittance, BotButtons.help]
    template_message = TemplateMessage(TextMessage(BotTexts.choose_one_option),
                                       buttons_list)
    send_message(message=template_message,
                 peer=user_peer,
                 step=Step.user_panel)
    dispatcher.register_conversation_next_step_handler(
        update,
        handlers=common_handlers + [
            MessageHandler(TemplateResponseFilter(BotButtons.remittance.value),
                           request_sender_name),
            MessageHandler(TemplateResponseFilter(BotButtons.help.value),
                           help_me)
        ])
Beispiel #14
0
 def __init__(self, dispatcher):
     self.dispatcher = dispatcher
     self.handlers = [
         MessageHandler(
             TemplateResponseFilter(ButtonMessage.officer_search_message),
             self.initiate_search_officers)
     ]
Beispiel #15
0
 def __init__(self, dispatcher):
     self.dispatcher = dispatcher
     self.handlers = [
         CommandHandler(['start', 'menu'], self.show_menu),
         MessageHandler(
             TemplateResponseFilter(ButtonMessage.main_menu_message),
             self.show_menu)
     ]
Beispiel #16
0
Datei: bot.py Projekt: mmdaz/Bot
def get_name_creditor(bot, update):
    user_peer = update.get_effective_user()
    creditor_name = update.get_effective_message()
    dispatcher.get_conversation_data(update,
                                     "debt").creditor_name = creditor_name.text
    bot.send_message(TemplateMessage(Message.GET_DEBT_YEAR, button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_debt_date_year),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
Beispiel #17
0
Datei: bot.py Projekt: mmdaz/Bot
def get_amount(bot, update):
    user_peer = update.get_effective_user()
    amount = update.get_effective_message()
    dispatcher.get_conversation_data(update, "debt").amount = amount.text
    bot.send_message(TemplateMessage(Message.GET_DEBT_CARD_NUMBER,
                                     button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_card_number),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
Beispiel #18
0
Datei: bot.py Projekt: mmdaz/Bot
def start_get_debt_conversation(bot, update):
    user_peer = update.get_effective_user()
    debt = Debt("", "", "", "", "", "", "")
    dispatcher.set_conversation_data(update, "debt", debt)
    debt.user_id = user_peer.get_json_str()
    bot.send_message(TemplateMessage(Message.GET_DEBT_AMOUNT, button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_amount),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
Beispiel #19
0
Datei: bot.py Projekt: mmdaz/Bot
def start_creating_alarm(bot, update):
    alarm = Alarm("", "", "", "", "", "", 5, "true")
    dispatcher.set_conversation_data(update, "alarm", alarm)
    user_peer = update.get_effective_user()
    alarm.user_id = user_peer.get_json_str()
    command = update.get_effective_message()
    bot.send_message(TemplateMessage(Message.GET_ALARM_NAME, button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_alarm_name),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
Beispiel #20
0
Datei: bot.py Projekt: mmdaz/Bot
def get_alarm_message(bot, update):
    user_peer = update.get_effective_user()
    alarm_message = update.get_effective_message()
    dispatcher.get_conversation_data(update,
                                     "alarm").message = alarm_message.text
    bot.send_message(TemplateMessage(Message.GET_ALARM_STOP_MESSAGE,
                                     button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_alarm_stop_message),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
def request_province_name(bot, update):
    user_peer = update.get_effective_user()
    province_names = select_all_province_names()
    province_name_buttons = get_template_buttons_from_list(province_names)
    template_message = TemplateMessage(
        TextMessage(BotTexts.choose_or_enter_province), province_name_buttons)
    send_message(message=template_message,
                 peer=user_peer,
                 step=Step.request_province_name)
    dispatcher.register_conversation_next_step_handler(
        update,
        handlers=common_handlers + [
            MessageHandler(TemplateResponseFilter(keywords=province_names),
                           request_branch_address),
            MessageHandler(TextFilter(), request_branch_address)
        ])
Beispiel #22
0
Datei: bot.py Projekt: mmdaz/Bot
def get_alarm_photo(bot, update):
    photo = update.get_effective_message()
    dispatcher.get_conversation_data(update,
                                     "alarm").photo = photo.get_json_str()
    user_peer = update.get_effective_user()
    bot.send_message(TemplateMessage(Message.GET_ALARM_YEAR, button_list),
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
    dispatcher.set_conversation_data(update=update,
                                     key="my_data",
                                     value="my_value")
    dispatcher.register_conversation_next_step_handler(update, [
        MessageHandler(TextFilter(), get_date_year),
        MessageHandler(TemplateResponseFilter(keywords="/start"), start_bot)
    ])
Beispiel #23
0
 def officer_score_initial_state(self, bot, update):
     self.handlers.extend(self.dispatcher.message_handlers)
     user = update.get_effective_user()
     message = TemplateMessage(
         TextMessage(ConstantMessage.report_begin_date_message),
         [TemplateMessageButton(ButtonMessage.main_menu_message)])
     self.send_message(bot, update, message, user,
                       sys._getframe().f_code.co_name)
     self.handlers.extend([
         MessageHandler(
             TemplateResponseFilter(
                 keywords=[ButtonMessage.main_menu_message]),
             self.show_menu),
     ])
     self.dispatcher.register_conversation_next_step_handler(
         update, self.handlers +
         [MessageHandler(TextFilter(), self.handle_report_begin_date)])
def request_province(bot, update):
    user_peer = update.get_effective_user()
    money_changer_id = update.get_effective_message().text
    money_changer = select_money_changer_by_id(money_changer_id)
    dispatcher.set_conversation_data(update, "money_changer", money_changer)
    branches = select_branches_by_money_changer_id(money_changer.id)
    province_set = get_province_set_from_branches(branches)
    dispatcher.set_conversation_data(update, "branches", branches)
    province_buttons = get_template_buttons_from_list(province_set)
    buttons_list = province_buttons + [BotButtons.back_to_main_menu]
    template_message = TemplateMessage(TextMessage(BotTexts.choose_province),
                                       buttons_list)
    send_message(message=template_message,
                 peer=user_peer,
                 step=Step.request_province)
    dispatcher.register_conversation_next_step_handler(
        update,
        handlers=common_handlers + [
            MessageHandler(TemplateResponseFilter(keywords=province_set),
                           request_branch)
        ])
Beispiel #25
0
        kwargs = {
            "message": template_message,
            "user_peer": user_peer,
            "try_times": 1
        }
        bot.send_message(template_message,
                         user_peer,
                         success_callback=success,
                         failure_callback=failure,
                         kwargs=kwargs)
        dispatcher.finish_conversation(update)
        return False


@dispatcher.message_handler(filters=[
    TemplateResponseFilter(keywords=[TMessage.start, TMessage.back]),
    TextFilter(keywords="start")
])
def start_conversation(bot, update):
    user_peer = update.get_effective_user()
    general_message = TextMessage(ReadyMessage.start_conversation)
    btn_list = [
        TemplateMessageButton(text=TMessage.send_tweet,
                              value=TMessage.send_tweet,
                              action=0),
        TemplateMessageButton(text=TMessage.get_home_time_line,
                              value=TMessage.get_home_time_line,
                              action=0),
        TemplateMessageButton(text=TMessage.search,
                              value=TMessage.search,
                              action=0),
Beispiel #26
0
        "message": template_message,
        "update": update,
        "bot": bot,
        "try_times": 1
    }
    bot.send_message(template_message,
                     user_peer,
                     success_callback=success_send_message,
                     failure_callback=success_send_message,
                     kwargs=kwargs)
    dispatcher.finish_conversation(update)


# =================================== Create new link =======================================================
@dispatcher.message_handler(
    filters=[TemplateResponseFilter(keywords=[TMessage.get_my_link])])
def create_new_link(bot, update):
    user_peer = update.get_effective_user()


# =================================== Help =======================================================
@dispatcher.message_handler(filters=[
    TemplateResponseFilter(keywords=[TMessage.help]),
    TextFilter(keywords="help")
])
def help_me(bot, update):
    user_peer = update.get_effective_user()
    btn_list = [
        TemplateMessageButton(text=TMessage.back,
                              value=TMessage.back,
                              action=0)
Beispiel #27
0
    kwargs = {
        "message": template_message,
        "update": update,
        "bot": bot,
        "try_times": 1
    }
    bot.send_message(template_message,
                     user_peer,
                     success_callback=success_send_message,
                     failure_callback=failure_send_message,
                     kwargs=kwargs)
    dispatcher.finish_conversation(update)


@dispatcher.message_handler(
    TemplateResponseFilter(keywords=[ButtonText.register]))
def registration(bot, update):
    dispatcher.clear_conversation_data(update)
    user_peer = update.get_effective_user()
    auth = get_verify_link()
    dispatcher.set_conversation_data(update, "auth", auth)
    verify_link = auth['auth_url']
    text_message = TextMessage(
        ReadyText.send_verify_number.format(verify_link))
    kwargs = {
        "message": text_message,
        "update": update,
        "bot": bot,
        "try_times": 1
    }
    bot.send_message(text_message,
Beispiel #28
0
Datei: bot.py Projekt: mmdaz/Bot
                             user_peer,
                             success_callback=success,
                             failure_callback=failure)

        await asyncio.sleep(30)


def create_time(year, month, day, hour, minute):
    time_string = "{}-{}-{} {}:{}:0.0".format(year, month, day, hour, minute)
    time_string_for_save = "{}:{}:{}:{}:{}".format(year, month, day, hour,
                                                   minute)
    return time_string_for_save


@dispatcher.command_handler("/start")
@dispatcher.message_handler(TemplateResponseFilter(keywords=["/start"]))
def start_bot(bot, update):
    user_peer = update.get_effective_user()
    input = update.get_effective_message()
    print(input.text)
    btn_list = [
        TemplateMessageButton("ساختن هشدار جدید ", "/create_alarm", 0),
        TemplateMessageButton("اضافه کردن بدهی ", "/add_debt", 0),
        TemplateMessageButton("گرفتن فایل اکسل صورتحساب ها  ", "/get_excel", 0)
    ]
    temlate_message = TemplateMessage(
        general_message=Message.START_BOT_MESSAGE, btn_list=btn_list)
    bot.send_message(temlate_message,
                     user_peer,
                     success_callback=success,
                     failure_callback=failure)
                     kwargs=kwargs)


@dispatcher.message_handler(DefaultFilter())
def start(bot, update):
    user_peer = update.get_effective_user()
    money_changer = select_money_changer_by_peer_id(user_peer.peer_id)
    if money_changer and money_changer.access_hash is None:
        update_money_changer_access_hash(money_changer, user_peer.access_hash)
    if money_changer and isinstance(money_changer, MoneyChanger):
        money_changer_panel(bot, update)
    else:
        user_panel(bot, update)


@dispatcher.message_handler(TemplateResponseFilter([BotButtons.help.value]))
def help_me(bot, update):
    user_peer = update.get_effective_user()
    buttons_list = [BotButtons.back_to_main_menu]
    template_message = TemplateMessage(general_message=TextMessage(
        BotTexts.help_message),
                                       btn_list=buttons_list)
    send_message(message=template_message, peer=user_peer, step=Step.help)
    dispatcher.register_conversation_next_step_handler(
        update, handlers=common_handlers)


# @dispatcher.message_handler(TemplateResponseFilter([BotButtons.user_panel.value]))
def user_panel(bot, update):
    user_peer = update.get_effective_user()
    buttons_list = [BotButtons.remittance, BotButtons.help]