Example #1
0
def show_quiz(update, context) -> 'telegram.Message':
    """ Entered /repeat command"""
    u = User.get_user(update, context)
    t = Translation.get_random_known_translation_for_user(u)
    if t is None:
        return context.bot.send_message(
            chat_id=u.user_id,
            text=no_repeat_words,
            reply_markup=telegram.ReplyKeyboardMarkup([
                [telegram.KeyboardButton(text="/new"),
                 telegram.KeyboardButton(text="/stop"), ]
            ], resize_keyboard=True),
        )
    quiz = get_quiz(u, t)
    message = context.bot.send_message(
        chat_id=u.user_id,
        text=f"{t.native_text} - ?",
        reply_markup=telegram.ReplyKeyboardMarkup(
            keyboard=[
                [telegram.KeyboardButton(text=w) for w in quiz],
                [telegram.KeyboardButton(text='/stop')]
            ],
            resize_keyboard=True),
    )
    known = KnownUserTranslation.objects.get(translation=t)
    CurrentUserQuiz(user=u, known_translation=known).save()
    return message
Example #2
0
 def start(self, bot, update):
     self.players = []
     self.chat_id = update.message.chat_id
     self.hello(bot, update)
     kb = [[
         telegram.KeyboardButton('/hello'),
         telegram.KeyboardButton('/start')
     ],
           [
               telegram.KeyboardButton('/new_game'),
               telegram.KeyboardButton('/join')
           ],
           [
               telegram.KeyboardButton('/start_game'),
               telegram.KeyboardButton('/leave')
           ],
           [
               telegram.KeyboardButton('/submit'),
               telegram.KeyboardButton('/new')
           ],
           [
               telegram.KeyboardButton('/players'),
               telegram.KeyboardButton('/help')
           ]]
     kb_markup = telegram.ReplyKeyboardMarkup(keyboard=kb,
                                              resize_keyboard=True)
     bot.send_message(chat_id=update.message.chat_id,
                      text="Let's play Lexikon",
                      reply_markup=kb_markup)
Example #3
0
def check(update, context):
    u = User.get_user(update, context)
    text = update.message.text

    quiz = CurrentUserQuiz.objects.filter(user=u).first()

    if quiz is None:
        return

    quiz_translation = quiz.known_translation.translation
    quiz.delete()

    if text == quiz_translation.translated_text:
        message = context.bot.send_message(
            chat_id=u.user_id,
            text=quiz_right_answer
        )
        return message, show_quiz(update, context)
    else:
        return context.bot.send_message(
            chat_id=u.user_id,
            text=str(quiz_translation),
            reply_markup=telegram.ReplyKeyboardMarkup([
                [telegram.KeyboardButton(text="/repeat"),
                 telegram.KeyboardButton(text="/stop"), ]
            ], resize_keyboard=True),
        )
Example #4
0
def start(update: Update, context: CallbackContext):
    chat_id = update.effective_chat.id
    logger.info(f"> Start chat #{chat_id}")
    # context.user_data["request_status"] = "no status"
    request_keyboard = telegram.KeyboardButton(text="Open new request")
    volunteer_keyboard = telegram.KeyboardButton(text="Volunteer")
    custom_keyboard = [[request_keyboard, volunteer_keyboard]]
    reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard,
                                                resize_keyboard=True,
                                                one_time_keyboard=False)
    path_image = os.path.join(os.getcwd(), "images\immage2.jpg")
    context.bot.sendPhoto(chat_id=chat_id,
                          photo=open(path_image, 'rb'),
                          caption=f"""Welcome to our project bot!
                            
For using the bot: 

/volunteer - to volunteer,
/request_help - to open a request help,
/show_all_areas - to show all our areas,
/show_all_open_requests - to show all the open requests,
/requests_in_my_areas - to show all opened requests in your selected areas,
/requests_by_area - to show all opened requests in a selected area,
/about_us - about "connected to life" """,
                          reply_markup=reply_markup)
    create_new_volunteer(update, context)
Example #5
0
def checkingOrders(bot, chat_id, order, job_queue, update):
    print('checkingOrders')
    kb_markup = telegram.ReplyKeyboardMarkup(
        [[telegram.KeyboardButton('Проверить оплату ✅')],
         [telegram.KeyboardButton('🔙 Вернуться в меню')]],
        resize_keyboard=True)
    orders = db.orders.find()
    if len(list(orders)) != 0:
        for x in db.orders.find():
            print('Debug 1')
            if x['order_id'] == order:
                print('Order 1')
                try:
                    updateClientOrder(chat_id, order, job_queue, update)
                except Exception as e:
                    print(e)
                try:
                    bot.send_message(
                        chat_id=chat_id,
                        text="💸 Оплатите заказ на сумму " +
                        str(getOrderCost(order)) +
                        ' на кошелек XXX. Через 12 часов бронь на заказ пропадет.',
                        reply_markup=kb_markup)
                except Exception as e:
                    print(e)
                break
Example #6
0
def start(bot, update):
    try:
        me = bot.get_me()

        # Welcome message
        msg = "Eae!\n"
        msg += "Eu sou o {0} .\n".format(me.first_name)
        msg += "Quer ver umas fotos maneiras de Dogs? \n\n"
        msg += "/support - Fale com o desenvolvedor\n"
        msg += "/settings - Configurações \n\n"
        msg += "/pic - Mostre a imagem de um Doggo com sobrancelha aleatório"

        # Commands menu
        main_menu_keyboard = [[telegram.KeyboardButton('/support')],
                              [telegram.KeyboardButton('/settings')],
                              [telegram.KeyboardButton('/pic')]]
        reply_kb_markup = telegram.ReplyKeyboardMarkup(main_menu_keyboard,
                                                       resize_keyboard=True,
                                                       one_time_keyboard=True)

        # Send the message with menu
        bot.send_message(chat_id=update.message.chat_id,
                         text=msg,
                         reply_markup=reply_kb_markup)
    except Exception as e:
        print(e)
Example #7
0
def forex_davinci_more_handler(bot, update):
    chat_id = update.message.chat_id
    lang = update.message.from_user.language_code
    button_strategies = telegram.KeyboardButton(
        text=_t("Стратегии заработка с DaVinci", lang))
    button_developers = telegram.KeyboardButton(
        text=_t("Про разработчиков", lang))
    button_community = telegram.KeyboardButton(
        text=_t("Про поддержку и сообщество", lang))
    button_howmuch = telegram.KeyboardButton(
        text=_t("Сколько стоит робот?", lang))
    button_contact_human = telegram.KeyboardButton(
        text=_t("Хочу поговорить с человеком", lang))

    reply_markup = telegram.ReplyKeyboardMarkup([[button_strategies],
                                                 [button_developers],
                                                 [button_community],
                                                 [button_howmuch],
                                                 [button_contact_human]])
    bot.send_message(
        chat_id=chat_id,
        text=_t(
            "Больше инфы про давинчи, про стратегии, стоимости, команду, поддержку, сообщество и т.д.",
            lang),
        reply_markup=reply_markup)
Example #8
0
def start_all(bot,update):


    chat_id = update.message.chat_id

    sell = telegram.KeyboardButton(text="buy")

    buy = telegram.KeyboardButton(text="sell")

    custom_keyboard =[[ sell, buy ]]

    reply_markup = telegram.ReplyKeyboardMarkup(
            custom_keyboard,one_time_keyboard=True)

    bot.send_message(chat_id=chat_id,
            text="Thank you",
            reply_markup=reply_markup
            )
    
    
    command= update.effective_message.text 

    print("TATATATATATATAT ",command)

    return CHOOSE
def start(bot, update):
    """
       Imprimindo mensagem de boas vindas e apresentando os possiveis comandos.
    """
    print("Iniciou!")
    me = bot.get_me()

    # Welcome message
    msg = "Bem vindo!\n"
    msg += "O {0} está a sua disposição.\n".format(me.first_name)
    msg += "O que você deseja fazer?\n\n"
    msg += "/reboot - Reiniciar sistema.\n"
    msg += "/download - Efetuar downloads.\n"
    msg += "/stop - Parar servidor."

    # Commands menu
    main_menu_keyboard = [[telegram.KeyboardButton('/reboot')],
                          [telegram.KeyboardButton('/download')],
                          [telegram.KeyboardButton('/stop')]]
    reply_kb_markup = telegram.ReplyKeyboardMarkup(main_menu_keyboard,
                                                   resize_keyboard=True,
                                                   one_time_keyboard=True)

    # Send the message with menu
    bot.send_message(chat_id=update.message.chat_id,
                     text=msg,
                     reply_markup=reply_kb_markup)
Example #10
0
 def is_allowed(self, bot, update):
     usr = update['message']['chat']
     uid = update['message']['chat']['id']
     if uid in self.blocked_users:
         bot.send_message(chat_id=uid,
                          text=self.error[403],
                          parse_mode='Markdown')
         return False
     if not uid in self.allowed_users:
         bot.send_message(chat_id=uid,
                          text=self.error[401],
                          parse_mode='Markdown')
         for admin in self.admins:
             custom_keyboard = [[
                 telegram.KeyboardButton(text="/allow {}".format(uid)),
                 telegram.KeyboardButton(text="/block {}".format(uid))
             ], [telegram.KeyboardButton(text="/clear".format(uid))]]
             reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
             message = "Grant access or block? {}\n".format(usr)
             message += "/allow {}\n".format(uid)
             message += "/block {}\n".format(uid)
             bot.send_message(chat_id=admin,
                              text=message,
                              parse_mode='Markdown',
                              reply_markup=reply_markup)
         return False
     return True
Example #11
0
    def __init__(self, cmd):
        custom_keyboard = [[telegram.KeyboardButton(download_state),
                            telegram.KeyboardButton(info)],
                           [telegram.KeyboardButton(add_torrent)],
                           [telegram.KeyboardButton(rm_torrent)]
                           ]

        self.reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
        torrent_add_state = getattr(TorrentState, 'add_torrent_state', None)
        torrent_rm_state = getattr(TorrentState, 'rm_torrent_state', None)
        if torrent_add_state:
            self.answer = self.add_torrent(state=torrent_add_state, options=cmd)
            return
        if torrent_rm_state:
            self.answer = self.rm_torrent(state=torrent_rm_state, options=cmd)
            return
        cmds_dict = {
            download_state: self.torrent_status,
            add_torrent: self.add_torrent,
            rm_torrent: self.rm_torrent,
            info: self.torrent_server_info,
        }

        if cmds_dict.get(cmd, None):
            func = cmds_dict.get(cmd)
            self.answer = func()
        else:
            self.answer = 'Command unsupported'
Example #12
0
 def create_text_telegram(self, data):
     custom_keyboard = False
     if data['send_location'] and not data.get('items'):
         custom_keyboard = telegram.ReplyKeyboardMarkup(
             [[
                 telegram.KeyboardButton(text="Send Location",
                                         request_location=True)
             ]],
             one_time_keyboard=True)
     if data['send_contact'] and not data.get('items'):
         custom_keyboard = telegram.ReplyKeyboardMarkup(
             [[
                 telegram.KeyboardButton(text="Send Contact",
                                         request_contact=True)
             ]],
             one_time_keyboard=True)
     if data.get('items') and data.get('send_location'):
         address = self.get_coordinates(data['items']['name'],
                                        data['items']['state'],
                                        data['items']['country'])
         data['bot'].send_location(data['chat_id'],
                                   latitude=address['latitude'],
                                   longitude=address['longitude'])
     if data['text_in_chat']:
         reply_keyboard = self.build_keyboard_inline_telegram(data['items'])
         data['bot'].send_message(data['chat_id'],
                                  data['message'],
                                  reply_markup=reply_keyboard)
     else:
         data['bot'].send_message(data['chat_id'],
                                  data['message'],
                                  reply_markup=custom_keyboard)
def location(bot, update, user_data):
    try:
        if (update.message.location):
            user_data['longitude'] = update.message.location.latitude
            user_data['latitude'] = update.message.location.longitude

        kb = [[telegram.KeyboardButton("1. " + translate("yes"))],
              [telegram.KeyboardButton("2. " + translate("no"))]]
        kb_markup = telegram.ReplyKeyboardMarkup(kb)
        bot.send_message(chat_id=update.message.chat_id,
                         text=translate("askForSaveUser"),
                         reply_markup=kb_markup)
        return SAVE_USER
        '''
        lat, lon = update.message.location.latitude, update.message.location.longitude
        user_data['location'] = (lat, lon)
        message = db[db['keyword'] == 'Hello'][user_data["melanoma"]].values[0]
        message = reduce(apply_replace, [("{NOM}", lambda x: user_data['name']),], message)
        bot.send_message(chat_id=update.message.chat_id, text=message)
        bot.send_message(chat_id=update.message.chat_id, text="Otherwise, tell me how can I help you")
        '''

    except Exception as e:
        print(e)
        bot.send_message(chat_id=update.message.chat_id,
                         text="💣{}".format(str(e)))

    return ConversationHandler.END
Example #14
0
def start(bot, update):
    chat_id = update.message.chat_id
    msg = "Alguém chamou a detetive Chika para descobrir quando os livros da BU precisam ser devolvidos?"
    main_menu_keyboard = [[telegram.KeyboardButton('/livros')], [telegram.KeyboardButton('/help')]]
    reply_kb_markup = telegram.ReplyKeyboardMarkup(main_menu_keyboard, resize_keyboard=True, one_time_keyboard=True)
    bot.send_photo(chat_id=chat_id, photo='https://www.geekgirlauthority.com/wp-content/uploads/2019/02/kaguyasama-detective-chika-2-627x376.png')
    bot.send_message(chat_id=chat_id, text=msg, reply_markup=reply_kb_markup)
Example #15
0
def new_word(update, context) -> 'telegram.Message':
    """ Entered /new command"""

    u = User.get_user(update, context)
    t = Translation.get_unknown_translation_for_user(u)
    if t is None:
        return context.bot.send_message(
            chat_id=u.user_id,
            text=no_new_words,
            reply_markup=telegram.ReplyKeyboardMarkup([[
                telegram.KeyboardButton(text="/repeat"),
                telegram.KeyboardButton(text="/stop"),
            ]],
                                                      resize_keyboard=True),
        )
    message = context.bot.send_message(
        chat_id=u.user_id,
        text=str(t),
        reply_markup=telegram.ReplyKeyboardMarkup([[
            telegram.KeyboardButton(text="/new"),
            telegram.KeyboardButton(text="/repeat"),
            telegram.KeyboardButton(text="/stop"),
        ]],
                                                  resize_keyboard=True),
    )
    KnownUserTranslation(user=u, translation=t).save()
    return message
Example #16
0
def start(bot, update):
    """
        Shows an welcome message and help info about the available commands.
    """
    me = bot.get_me()

    # Welcome message
    # msg = "Hello!\n"
    # msg += "I'm {0} and I came here to help you.\n".format(me.first_name)
    # msg += "What would you like to do?\n\n"
    # msg += "/support - Opens a new support ticket\n"
    # msg += "/settings - Settings of your account\n\n"
    msg = "Ola, eu sou Judite, a bibliotecaria.\n Esses comandos vao te ajudar:\n\n"
    msg += "/livros - Exibe os livros disponiveis\n"
    msg += "/pegar [id] - Marca um livro como estando com voce\n"
    msg += "/emprestimos - Exibe os seus emprestimos\n"
    msg += "/devolver [id] - devolve um livro que estava com voce\n"

    # Commands menu
    main_menu_keyboard = [
        [telegram.KeyboardButton('/livros')]  #,
        #,telegram.KeyboardButton('/start')],
        ,
        [telegram.KeyboardButton('/emprestimos')]
    ]
    reply_kb_markup = telegram.ReplyKeyboardMarkup(main_menu_keyboard,
                                                   resize_keyboard=True,
                                                   one_time_keyboard=True)

    # Send the message with menu
    bot.send_message(chat_id=update.message.chat_id,
                     text=msg,
                     reply_markup=reply_kb_markup)
Example #17
0
def webhook_handler():
    if request.method == "POST":
        update = telegram.Update.de_json(request.get_json(force=True), bot)

        try:
            chat_id = update.message.chat.id
            text = update.message.text
            userid = update.message.from_user.id
            username = update.message.from_user.username

            start_handler = CommandHandler('start', start)
            dispatcher.add_handler(start_handler)
            # updater.start_polling()

            location_keyboard = telegram.KeyboardButton(text="send_location", request_location=True)
            contact_keyboard = telegram.KeyboardButton(text="send_contact", request_contact=True)
            custom_keyboard = [[location_keyboard, contact_keyboard]]
            reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
            bot.send_message(chat_id=chat_id,
                             text="Would you mind sharing your location and contact with me?",
                             reply_markup=reply_markup)

        except Exception as e:
            print(e)
    return 'ok'
Example #18
0
def start(bot, update):
    """Start off things with a welcome message and a description
    of what the bot does."""
    global BOTSTATE

    BOTSTATE = STARTMODE

    welcome_text = 'Hello Aurora! I\'m a bot that find and sends '+\
                   'you beautiful pictures of earth and space! Ashwin made '+\
                   'me as a gift to you because he knows how much '+\
                   'you love the stars and earth and because he loves you a lot!'+\
                   ' Have fun!\n\n' + \
                   'If you want to change the subject of the pictures use the command: \n'+\
                   '/subject'+\
                   telegram.emoji.Emoji.SMILING_FACE_WITH_SMILING_EYES +\
                   '\n\n What do you want to do?'

    custom_keyboard = [[telegram.KeyboardButton(NEEDPICS)],
                       [telegram.KeyboardButton(NOTHINGNOW)]]
    reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard,
                                                resize_keybaord=True,
                                                one_time_keyboard=True)
    bot.sendMessage(chat_id=update.message.chat_id,
                    text=welcome_text,
                    reply_markup=reply_markup)
Example #19
0
def checkingNumber(bot, update):
    kb = [[
        telegram.KeyboardButton('Наличие 💊'),
        telegram.KeyboardButton('Проверить оплату ✅')
    ],
          [
              telegram.KeyboardButton('Инструкция 📄'),
              telegram.KeyboardButton('Оператор 📱')
          ]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, resize_keyboard=True)
    back_markup = telegram.ReplyKeyboardMarkup(
        [[telegram.KeyboardButton('🔙 Вернуться в меню')]],
        resize_keyboard=True)
    msg = update.message.text
    if msg == u'🔙 Вернуться в меню':
        update.effective_message.reply_text('Выбери пункт меню 👇',
                                            reply_markup=kb_markup)
        return ConversationHandler.END
    elif msg.isdigit():
        update.effective_message.reply_text(
            'Ожидайте подтверждения транзакции. ✅ Время ожидания от 5 до 20 минут!',
            reply_markup=back_markup)
        chekingTransaction(bot, update, msg)
    else:
        update.effective_message.reply_text(
            'Вы ввели что-то не так, введите номер транзакции, без никаких дополнительных символов 👇',
            reply_markup=back_markup)
        return 1
Example #20
0
def changeAdmin(bot, update):
    admin = db.clients.find_one({'admin': True})
    if admin != None:
        db.clients.update({'chat_id': admin['chat_id']}, {
            'chat_id': admin['chat_id'],
            'order_id': None,
            'admin': False
        },
                          upsert=True)

    chat_id = update.message.chat_id
    db.clients.update({'chat_id': chat_id}, {
        'chat_id': chat_id,
        'order_id': None,
        'admin': True
    },
                      upsert=True)
    kb = [[telegram.KeyboardButton('1:Посмотреть статистику')],
          [telegram.KeyboardButton('2:Добавить клад')],
          [telegram.KeyboardButton('3:Удалить клады')],
          [telegram.KeyboardButton('4:Изменить админа')]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, resize_keyboard=True)
    bot.send_message(chat_id=update.message.chat_id,
                     text="Выберите пункт админ-панели:",
                     reply_markup=kb_markup)
Example #21
0
 def __language_menu(self):
     """Select a language."""
     log.debug("Displaying __language_menu")
     keyboard = []
     options: Dict[str, str] = {}
     # https://en.wikipedia.org/wiki/List_of_language_names
     if "en" in self.cfg["Language"]["enabled_languages"]:
         lang = "🇬🇧 English"
         keyboard.append([telegram.KeyboardButton(lang)])
         options[lang] = "en"
     if "uz" in self.cfg["Language"]["enabled_languages"]:
         lang = "🇺🇿 Uzbek tili"
         keyboard.append([telegram.KeyboardButton(lang)])
         options[lang] = "uz"
     if "ru" in self.cfg["Language"]["enabled_languages"]:
         lang = "🇷🇺 Русский"
         keyboard.append([telegram.KeyboardButton(lang)])
         options[lang] = "ru"
     # Send the previously created keyboard to the user (ensuring it can be clicked only 1 time)
     self.bot.send_message(self.chat.id,
                           self.loc.get("conversation_language_select"),
                           reply_markup=telegram.ReplyKeyboardMarkup(
                               keyboard, one_time_keyboard=True))
     # Wait for an answer
     response = self.__wait_for_specific_message(list(options.keys()))
     # Set the language to the corresponding value
     self.user.language = options[response]
     # Commit the edit to the database
     self.session.commit()
     # Recreate the localization object
     self.__create_localization()
Example #22
0
def localizacao(update: Update, context: CallbackContext):
    reply_markup = telegram.ReplyKeyboardMarkup([[
        telegram.KeyboardButton('Enviar localização', request_location=True)
    ], [telegram.KeyboardButton('Sair')]],
                                                resize_keyboard=True,
                                                one_time_keyboard=True)
    update.message.reply_text("Menu", reply_markup=reply_markup)
Example #23
0
def start(bot, update):
    print(bot, update)
    me = bot.get_me()
    print(me)

    # Welcome message
    msg = "Olá\n"
    msg += "Eu sou {0} e tamo aqui para ajudar.\n".format(me.first_name)
    msg += "O que gostaria?\n\n"
    msg += "/find_reservations - Buscar suas reservas\n"
    msg += "/ask_reservation - Criar nova reserva\n\n"
    msg += "/support - Falar com suporte\n\n"
    print(msg)

    try:
        # Commands menu
        main_menu_keyboard = [[telegram.KeyboardButton('/find_reservations')],
                              [telegram.KeyboardButton('/ask_reservation')],
                              [telegram.KeyboardButton('/support')]]
        reply_kb_markup = telegram.ReplyKeyboardMarkup(
            keyboard=main_menu_keyboard,
            resize_keyboard=True,
            one_time_keyboard=True)

        # Send the message with menu
        bot.send_message(chat_id=update.message.chat_id,
                         text=msg,
                         reply_markup=reply_kb_markup)
    except Exception as e:
        print("Error")
        print(e)
Example #24
0
def start(update, context):
    user = update.message.from_user
    logger.info("User {} has started to use FAANG bot".format(
        user.first_name, update.message.text))
    # context.bot.send_message(chat_id=update.effective_chat.id, text="⌛⌛⌛ Grabbing data, please allow approximately 5s!")
    global df, dfScaled, a, b, c, dfRecommendations
    df, dfScaled, a, b, c, dfRecommendations = getData()
    context.bot.send_message(chat_id=update.effective_chat.id,
                             text="Connected! ✅ Latest data is at {}".format(
                                 df.iloc[-1].Date.strftime('%d-%m-%Y')))
    context.bot.send_message(
        chat_id=update.effective_chat.id,
        text="👋👋 Hey there! Welcome to the the FAANG Stocks Chatbot! 🤖")
    context.bot.send_message(
        chat_id=update.effective_chat.id,
        text=
        "👩‍💻👩‍💻👩‍💻 **FAANG** refers to the five most popular and best-performing US tech companies: _Facebook, Amazon, Apple, Netflix and Alphabet_.",
        parse_mode=telegram.ParseMode.MARKDOWN)
    kb = [[telegram.KeyboardButton('Facebook')],
          [telegram.KeyboardButton('Amazon')],
          [telegram.KeyboardButton('Apple')],
          [telegram.KeyboardButton('Netflix')],
          [telegram.KeyboardButton('Google')]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, one_time_keyboard=True)
    update.message.reply_text(
        "🚀 To continue, please kindly select one of the FAANG stock 🚀\n\n Alternatively, type /No anywhere to cancel.\n\n_Do scroll down for your keyboard options_",
        reply_markup=kb_markup,
        parse_mode=telegram.ParseMode.MARKDOWN)
    return FAANG
Example #25
0
def giveAtt(update, context):
    user = update.message.from_user
    logger.info("1: User {} started giving attendance via /start".format(user.first_name))
    context.bot.send_message(chat_id=update.effective_chat.id, text="👋 Hello, I'm an NTUDB attendance bot! 😀")
    kb = [[telegram.KeyboardButton('/Yes')],
          [telegram.KeyboardButton('/No')]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, one_time_keyboard=True)
    update.message.reply_text("🚀  Are you ready to commit your attendance 🔥", reply_markup=kb_markup)
    return CONT
Example #26
0
def setAdmin(bot, update):
    kb = [[telegram.KeyboardButton('1:Посмотреть статистику')],
          [telegram.KeyboardButton('2:Добавить клад')],
          [telegram.KeyboardButton('3:Удалить клады')],
          [telegram.KeyboardButton('4:Изменить админа')]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, resize_keyboard=True)

    bot.send_message(chat_id=update.message.chat_id,
                     text="Напишите секретный код, если хотите стать админом",
                     reply_markup=kb_markup)
Example #27
0
 def error_msg():
     location_button = telegram.KeyboardButton(text="Suggest a location")
     all_location_button = telegram.KeyboardButton(text="See all locations")
     custom_keyboard = [[location_button], [all_location_button]]
     reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard,
                                                 one_time_keyboard=True,
                                                 resize_keyboard=True)
     bot.send_message(chat_id=update.message.chat_id,
                      text="Aiyo paiseh got error LOL try again can?",
                      reply_markup=reply_markup)
Example #28
0
def thankyou(bot, update):
    chat_id = update.message.chat_id

    location_keyboard = telegram.KeyboardButton(text=SEND_LOCATION,
                                                request_location=True)
    fire_keyboard = telegram.KeyboardButton(text=FIRE)

    custom_keyboard = [[location_keyboard, fire_keyboard]]
    reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
    bot.send_message(chat_id=chat_id, text=THANKYOU, reply_markup=reply_markup)
Example #29
0
def start(bot, update):
    username = update.message.from_user.username 
    with open('data/userplay.txt', 'a') as f:
                  json.dump(username, f, ensure_ascii=False)
    kb = [[telegram.KeyboardButton('/FAQ'),telegram.KeyboardButton('/About Koompi')]]
    kb_markup = telegram.ReplyKeyboardMarkup(kb, resize_keyboard=True)

    bot.send_message(chat_id=update.message.chat_id,
                     text="@"+username,
                     reply_markup=kb_markup)
Example #30
0
def activate(bot, chat_id):
    kb = [[telegram.KeyboardButton("/near")],
          [telegram.KeyboardButton("/near_cat")],
          [telegram.KeyboardButton("/ask")],
          [telegram.KeyboardButton("/help")],
          [telegram.KeyboardButton("/about")]]
    markup = telegram.ReplyKeyboardMarkup(kb)
    bot.send_message(chat_id=chat_id,
                     text='Выберите команду',
                     reply_markup=markup)