Esempio n. 1
0
def chat_handle(msg):
    global action
    global users
    # loadUsers()
    try:
        # pprint.pprint(msg)
        action = random.randint(0, 99999)
        content_type, chat_type, chatid, msg_date, msg_id = telepot.glance(
            msg, flavor='chat', long=True)
        text = msg["text"].replace("/", "")

        if text == "start":
            keyboard = InlineKeyboardMarkup(inline_keyboard=[
                [
                    InlineKeyboardButton(text="🕹 Gioca! 🕹",
                                         callback_data="play")
                ],
                [
                    InlineKeyboardButton(text="👾 Profilo 👾",
                                         callback_data="profile"),
                    InlineKeyboardButton(text="📟 Classifica 📟",
                                         callback_data="leaderboard")
                ],
                [
                    InlineKeyboardButton(text="🤖 Info sul bot 🤖",
                                         callback_data="info")
                ]
            ])
            msg_id = send_and_log(
                chatid,
                "***Benvenuto su pyGameBot! Il primo bot Telegram di mini-giochi!***"
                + "\n\n```" + '\t' * 12 + "Bot Sviluppato da @MRtecno98```",
                parse_mode='Markdown',
                reply_markup=keyboard)

            try:
                username = msg["from"]["username"]
            except KeyError:
                username = None

            try:
                surname = msg["from"]["last_name"]
            except KeyError:
                surname = None

            if chatid not in list(users.keys()):
                create_new_user(chatid, msg_id["message_id"],
                                msg["from"]["first_name"], surname, username)
    finally:
        # saveUsers()
        print("", end='')

    return
def creditos(msg):
    remove_buttons(msg)
    bot.sendMessage(
        msg['message']['chat']['id'],
        "Segue abaixo o nome das pessoas que participaram no meu desenvolvimento 😊\n\n"
        + "Prof. Dr. Fábio Santos da Silva" + "\nErik Atilio Silva Rey" +
        "\nOscar de Menezes Neto" + "\nRamayana Menezes",
        parse_mode="Markdown",
        reply_markup=InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="⬅ VOLTAR",
                                 callback_data="VOLTAR pressed")
        ]]))
Esempio n. 3
0
def run(message, matches, chat_id, step):
    response = Message(chat_id)
    res = show_help(0)
    if public_plugins:
        res.append(
            [InlineKeyboardButton(text='Next ▶️', callback_data='/helpn 1')])
    markup = InlineKeyboardMarkup(inline_keyboard=res)
    response.set_text(
        "Welcome to 🎗Butely Bot🎗\n▪️▪️▪️▪️▪️▪️▪️▪️▪️▪️\n🔷In the Helps Items maybe you can see These Commands :\n🔺{Inline} means you can use that command inline.\n🔺<Reply> means you must reply a message.\n💠Select one of these Items.",
        parse_mode="Markdown",
        reply_markup=markup)
    return [response]
Esempio n. 4
0
def sendbets():
    bets = betgrab.grab()
    for bet in bets:
        markup = InlineKeyboardMarkup(
            inline_keyboard=[[dict(text='Поставить💸', url=OFFER)]])
        bot.sendPhoto(GROUP, photo=bet['pfc'])
        bot.sendPhoto(GROUP, photo=bet['psc'])
        bot.sendMessage(GROUP,
                        choice(MESSAGES['betinfo']).format(
                            bet['date'], bet['tags'], bet['first_command'],
                            bet['second_command'], bet['prediction']),
                        reply_markup=markup)
Esempio n. 5
0
def on_chat_message(msg):
    try:
        username = msg.get('from').get('username')
    except:
        username = '******'
    content_type, chat_type, chat_id, = telepot.glance(msg)

    keyboard = InlineKeyboardMarkup(inline_keyboard=[
        [InlineKeyboardButton(text='Take photo', callback_data='take_photo')],
    ])

    bot.sendMessage(chat_id, 'Hi, ' + username, reply_markup=keyboard)
Esempio n. 6
0
    def generate_all_users_keyboard(self, all_users_data):
        keyboard_key_list = []

        for idx, user in enumerate(all_users_data):
            keyboard_key_list.append([
                InlineKeyboardButton(
                    text=str(idx + 1) + ". " + user.get('username'),
                    callback_data="user_detail:" + str(user.get('id')))
            ])

        keyboard = InlineKeyboardMarkup(inline_keyboard=keyboard_key_list)
        return keyboard
Esempio n. 7
0
def profile_menu_inline(enemy_user_id):
    keyboard = InlineKeyboardMarkup(
        inline_keyboard=[[
            InlineKeyboardButton(text=MESSAGE,
                                 callback_data='dopoke:' + str(enemy_user_id))
        ],
                         [
                             InlineKeyboardButton(text=ATTACK,
                                                  callback_data='doattack:' +
                                                  str(enemy_user_id))
                         ]])
    return keyboard
Esempio n. 8
0
    def create_inline_buttons(self, user, text, buttons):
        keyboard = None
        if isinstance(buttons[0], str):
            keyboard = [[InlineKeyboardButton(text=x, callback_data=x)]
                        for x in buttons]
        elif isinstance(buttons[0], list):
            keyboard = [[
                InlineKeyboardButton(text=y, callback_data=y) for y in x
            ] for x in buttons]

        markup = InlineKeyboardMarkup(inline_keyboard=keyboard)
        self.bot.sendMessage(user, text, reply_markup=markup)
Esempio n. 9
0
    def _get_select_profile_keyboard(self, additional_data: str = '',
                                     selected_button_idx: Optional[int] = None) -> InlineKeyboardMarkup:
        def command_provider(i: int, txt: str) -> str:
            res = f'/select_profile {i}'
            if additional_data:
                res += f' {additional_data}'
            return res

        buttons = self._get_flat_inline_keyboard_buttons(['1️⃣', '2️⃣'],
                                                         command_provider,
                                                         selected_button_idx)
        return InlineKeyboardMarkup(inline_keyboard=[buttons])
Esempio n. 10
0
def _process_movies_markup(text_more, callback_url, number_of_movies,
                           more_date, markup_tomorrow_text,
                           markup_tomorrow_date):
    return InlineKeyboardMarkup(inline_keyboard=[[
        dict(text=text_more,
             callback_data=(callback_url.format(
                 number_of_movies + settings.FILMS_TO_DISPLAY, more_date))),
        dict(text=markup_tomorrow_text,
             callback_data=(callback_url.format(
                 number_of_movies +
                 settings.FILMS_TO_DISPLAY, markup_tomorrow_date)))
    ]])
Esempio n. 11
0
def check_eliminate_keyboard(chat_id, chapter, message_id, query_id):
    response = "*Tem certeza?*\n\nVocê está prestes a eliminar '" + chapter + "' e não há como reverter essa decisão!"

    keyboard = InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text='Eliminar',
                                 callback_data='eliminate$$' + chapter + '$$y')
        ],
        [InlineKeyboardButton(text='<< Voltar', callback_data='eliminate')],
    ])
    edit_message(message_id, response, keyboard)
    answer_callback_query(query_id)
Esempio n. 12
0
def on_chat_message(msg):
    command = msg['text'].lower()
    content_type, chat_type, chat_id = telepot.glance(msg)
    if content_type == 'text':
        if command == '/rates':
            keyboard = InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='USD', callback_data='first')],
                [InlineKeyboardButton(text='EUR', callback_data='second')],
                [InlineKeyboardButton(text='GBP', callback_data='third')]

            ])
            bot.sendMessage(chat_id, 'Choose currency', reply_markup=keyboard)
        elif command == '/usd':
            InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='USD', callback_data='first')]])
            url = "https://www.cbr-xml-daily.ru/daily_json.js"
            r = requests.get(url).json()
            f = (r["Valute"]["USD"]["Value"])
            bot.sendMessage(chat_id, f)
            bot.sendMessage(chat_id, 'рублей стоит один доллар')
        elif command == '/eur':
            InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='EUR', callback_data='first')]])
            url = "https://www.cbr-xml-daily.ru/daily_json.js"
            r = requests.get(url).json()
            f = (r["Valute"]["EUR"]["Value"])
            bot.sendMessage(chat_id, f)
            bot.sendMessage(chat_id, 'рублей стоит один евро')
        elif command == '/gbp':
            InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='GBP', callback_data='first')]])
            url = "https://www.cbr-xml-daily.ru/daily_json.js"
            r = requests.get(url).json()
            f = (r["Valute"]["GBP"]["Value"])
            bot.sendMessage(chat_id, f)
            bot.sendMessage(chat_id, 'рублей стоит один фунт')
        elif command == '/start':
            bot.sendMessage(chat_id, "Команды: курс доллара /usd, евро /eur, фунта /gbp. Помощь /help, inline /rates")
        elif command == '/help':
            bot.sendMessage(chat_id, "Связь с разработчиком @nikdmi")
Esempio n. 13
0
def set_trigger_condition(message_id, query_id, is_rain=False):
    prefix = f"""
Perfeito!
Agora, note que:
"""
    msg = f"""
- As temperaturas serão fornecidas em graus Celsius
- Nebulosidade é informada pela porcentagem de cobertura do céu
- Umidade é informada pela porcentagem de umidade do ar

Baseado nisto, escolha se deseja disparar o gatilho para um valor maior ou menor do que o que você inserir.
"""
    msg_rain = """
- Gatilhos de chuva apenas dizem se haverá chuva ou não, independentemente da intensidade dela

Baseado nisto, escolha se deseja disparar o gatilho quando for ou quando *não* for chover 
"""

    kbd = [[
        InlineKeyboardButton(text='Menor que',
                             callback_data='notification.set.trig_cond.lt')
    ],
           [
               InlineKeyboardButton(
                   text='Maior que',
                   callback_data='notification.set.trig_cond.gt')
           ]]

    rain_kbd = [[
        InlineKeyboardButton(text='Quando chover',
                             callback_data='notification.set.trig_cond.rain')
    ],
                [
                    InlineKeyboardButton(
                        text='Quando não chover',
                        callback_data='notification.set.trig_cond.not_rain')
                ]]

    if is_rain:
        kbd = rain_kbd
        msg = msg_rain

    msg = prefix + msg

    keyboard = InlineKeyboardMarkup(inline_keyboard=kbd)

    if len(message_id) > 1:
        edit_message(message_id, msg, keyboard)
    else:
        chat_id = message_id
        inline_keyboard_message(chat_id, msg, keyboard)
    answer_callback_query(query_id)
Esempio n. 14
0
    async def display(self, reply, data, msg):
        keyboard = []
        next_page = data and data.get('next_page') or None
        previous_page = data and data.get('prev_page') or None
        image = data and data.get('image') or None

        if previous_page:
            keyboard.append(
                InlineKeyboardButton(text='prev {}'.format(previous_page),
                                     callback_data='previous'))
        if next_page:
            keyboard.append(
                InlineKeyboardButton(text='next {}'.format(next_page),
                                     callback_data='next'))
        if data.get('result'):
            keyboard.append(
                InlineKeyboardButton(text='view', callback_data='image'))
            keyboard.append(
                InlineKeyboardButton(
                    text='delete', callback_data='this_is_delete_intent_key'))
        if image:
            await self.bot.sendPhoto(msg['message']['chat']['id'], image)
            return data

        markup = keyboard and InlineKeyboardMarkup(
            inline_keyboard=[keyboard]) or None
        if telepot.flavor(msg) == 'callback_query' and not image:
            c, m = msg['message']['chat']['id'], msg['message']['message_id']
            try:
                await self.bot.editMessageText((c, m),
                                               reply,
                                               reply_markup=markup,
                                               parse_mode='HTML')
            except Exception as e:
                print(e)
            return data

        content_type, chat_type, chat_id = telepot.glance(msg)
        last_id = data.get('last_query_id')
        last_markup = data.get('last_query_markup')
        pages = next_page or previous_page
        if last_id and last_markup and pages:
            await self.bot.editMessageReplyMarkup((last_id[0], last_id[1]),
                                                  reply_markup=None)
        # response = await self.bot.sendMessage(chat_id, reply, reply_markup=markup)
        response = await self.bot.sendMessage(chat_id,
                                              reply,
                                              reply_markup=markup,
                                              parse_mode='HTML')
        data['last_query_id'] = [chat_id, response['message_id']]
        data['last_query_markup'] = markup and True or False
        return data
Esempio n. 15
0
    def on_chat_message(self, msg):
        content_type, chat_type, chat_id = telepot.glance(msg)
        print('Chat:', content_type, chat_type, chat_id)

        if content_type != 'text':
            return

        command = msg['text'][-1:].lower()

        if command == 'c':
            markup = ReplyKeyboardMarkup(keyboard=[
                ['Plain text', KeyboardButton(text='Text only')],
                [
                    dict(text='Phone', request_contact=True),
                    KeyboardButton(text='Location', request_location=True)
                ],
            ])
            yield from self.sendMessage(chat_id,
                                        'Custom keyboard with various buttons',
                                        reply_markup=markup)
        elif command == 'i':
            markup = InlineKeyboardMarkup(inline_keyboard=[
                [dict(text='Telegram URL', url='https://core.telegram.org/')],
                [
                    InlineKeyboardButton(text='Callback - show notification',
                                         callback_data='notification')
                ],
                [dict(text='Callback - show alert', callback_data='alert')],
                [
                    InlineKeyboardButton(text='Callback - edit message',
                                         callback_data='edit')
                ],
                [
                    dict(text='Switch to using bot inline',
                         switch_inline_query='initial query')
                ],
            ])

            self._message_with_inline_keyboard = yield from self.sendMessage(
                chat_id,
                'Inline keyboard with various buttons',
                reply_markup=markup)
        elif command == 'h':
            markup = ReplyKeyboardHide()
            yield from self.sendMessage(chat_id,
                                        'Hide custom keyboard',
                                        reply_markup=markup)
        elif command == 'f':
            markup = ForceReply()
            yield from self.sendMessage(chat_id,
                                        'Force reply',
                                        reply_markup=markup)
Esempio n. 16
0
	def __init__(self):

		s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
		s.connect(('8.8.8.8',80))
		self.address=s.getsockname()[0]
		#self.catalog="http://192.168.1.103:8080"
		self.catalog=json.loads(open("catalog.json").read())["catalog"]
		'''
		self.my_data={
		"telegram_triage":
			{	
			"ip":socket.gethostbyname(socket.gethostname()),
			"port":8086,
			"chatId": "359387363",
			"token":"957562924:AAFlHxtAxnFf02QF1U6Phvle2bH_wVEd1ns",
			"topic":["inputdata"],
			"subscriber":["queue_server"],
			}
		}'''

		

		self.my_data=json.loads(open("triageData.json").read())
		self.my_data["telegram_triage"]["ip"]=self.address

		'''
		self.js={}
		self.readyToSend=False

		self.flagName = False
		self.flagSurname = False
		self.flagAge = False
		self.flagGender = False
		self.flagWeight = False
		self.flagHeight = False
		self.flagCod = False
		self.flagRep = False
		self.flagSh = False
		self.flagSg = False
		self.flagSp = False
		self.flagExit= False
		'''

		self.users={}
		#self.resourceUrl = rU
		self.bot = telepot.Bot(self.my_data["telegram_triage"]["token"])
		# creating the buttons
		self.keyboard = InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text='Insert data', callback_data='Insert')],[InlineKeyboardButton(text="Statistics", callback_data='statistics')]])
				

		# associating the button with the callbacks
		MessageLoop(self.bot, {'chat': self.on_chat_message,'callback_query': self.on_callback_query}).run_as_thread()
def sintomas_user_crianca(msg):
    remove_buttons(msg)
    bot.sendMessage(
        msg['message']['chat']['id'],
        "*Pergunta 2/3*\n\nA criança tem algum desses sintomas? 🤔" +
        "\n\n*Febre*\n*Tosse*\n*Dor de garganta*\n*Dificuldade respiratória*\n",
        parse_mode="Markdown",
        reply_markup=InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="✅ SIM",
                                 callback_data="SIM SINTOMAS CRIANÇA pressed"),
            InlineKeyboardButton(text="❌ NÃO",
                                 callback_data="NÃO SINTOMAS CRIANÇA pressed")
        ]]))
Esempio n. 18
0
def on_chat_message(msg):
    content_type, chat_type, chat_id = telepot.glance(msg)

    keyboard = InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text='Натисни мене пліз',
                                 callback_data='press')
        ],
    ])

    bot.sendMessage(chat_id,
                    'inline keyboard. Хз що це таке',
                    reply_markup=keyboard)
Esempio n. 19
0
def photos(info, pos, lang):
    kboard = []
    res = []
    text = translate.photos(lang)
    if pos > 0:
        res = [InlineKeyboardButton(text=text[0], callback_data=str(pos - 1))]
    if pos + 1 < len(info['photos']):
        res += [InlineKeyboardButton(text=text[1], callback_data=str(pos + 1))]
    kboard.append(res)
    res = [InlineKeyboardButton(text=text[2], callback_data='back')]
    kboard.append(res)
    markupPhotos = InlineKeyboardMarkup(inline_keyboard=kboard)
    return markupPhotos
Esempio n. 20
0
def recAudioMenu(step):
    if step == 1:
        keyboard = InlineKeyboardMarkup(inline_keyboard=[
           [InlineKeyboardButton(text= "Time in seconds (default: " + str(default_rec_time) + "  seconds)", callback_data = 'default_rec_time_change')],
           [InlineKeyboardButton(text= "Start Record", callback_data = 'start_rec_audio')],
           [InlineKeyboardButton(text= "Return to Main Menu", callback_data = 'return_main_menu')]]
           )

        bot.sendMessage(CHAT_ID, "###Audio Recording Menu###\nSelect what you wanna do:", reply_markup=keyboard)
    elif step == 2:
        bot.sendMessage(CHAT_ID, "Enter amount of seconds to be recorded: ")
        global change_rec_time_step
        change_rec_time_step = 1
Esempio n. 21
0
 def showBags(self, chat_id):
     user_data = self.users[self.dict[chat_id]]
     user_bags = [x.bag_id for x in user_data]
     in_keyboard = []
     for x in user_bags:
         in_keyboard.append(
             [InlineKeyboardButton(text=str(x), callback_data=str(x))])
     in_keyboard.append(
         [InlineKeyboardButton(text="Log Out", callback_data='r')])
     self.bot.sendMessage(
         chat_id,
         "Choose among the following bags",
         reply_markup=InlineKeyboardMarkup(inline_keyboard=in_keyboard))
def manage_categories(chat_id):
    keyboard = InlineKeyboardMarkup(inline_keyboard=[
                   [InlineKeyboardButton(text='Entertainment', callback_data='Entertainment')],
                   [InlineKeyboardButton(text='Personal Care', callback_data='Personal Care')],
                   [InlineKeyboardButton(text='Food and Dining', callback_data='Food and Dining')],
                   [InlineKeyboardButton(text='Auto and Transport', callback_data='Auto and Transport')],
                   [InlineKeyboardButton(text='Investments or Debt Repayments', callback_data='Investments or Debt Repayments')],
                   [InlineKeyboardButton(text='Miscellaneous', callback_data='Miscellaneous')],
                   [InlineKeyboardButton(text='Savings', callback_data='Savings')]

                ] )

    bot.sendMessage(chat_id, 'Please choose a category.', reply_markup=keyboard)
Esempio n. 23
0
def select(query_data, chat_id, bot):
    if query_data[0] == '날씨':
        bot.sendMessage(chat_id, get_weather())

    elif query_data[0] == '구독':

        tam = db.sub.find_one({"channel": chat_id})
        print(chat_id)
        print(tam)

        if tam == None:
            sub_keyboard = InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='구독하기', callback_data='신청')],
            ])

        else:
            sub_keyboard = InlineKeyboardMarkup(inline_keyboard=[
                [InlineKeyboardButton(text='구독해지', callback_data='해지')],
            ])

        bot.sendMessage(chat_id, '선택해주세요.', reply_markup=sub_keyboard)

    elif query_data[0] == '신청':
        db.sub.insert_one({'channel': chat_id})
        bot.sendMessage(chat_id, '구독이 완료되었습니다. :)')

    elif query_data[0] == '해지':
        db.sub.delete_one({'channel': chat_id})
        bot.sendMessage(chat_id, '구독이 해지되었습니다. :(')

    elif query_data[0] == '완료':
        reply_string = make_reply_string(query_data)
        bot.sendMessage(chat_id, reply_string)

    else:
        reply_list, next_node = make_list(query_data)
        reply_keyboard = make_keyboard(reply_list, next_node)
        reply_ment = "원하시는 " + query_data[0] + "를 선택해주세요."
        bot.sendMessage(chat_id, reply_ment, reply_markup=reply_keyboard)
Esempio n. 24
0
    def _init_ballot(self):
        keyboard = InlineKeyboardMarkup(inline_keyboard=[[
                       InlineKeyboardButton(text='Yes', callback_data='yes'),
                       InlineKeyboardButton(text='Nah!!!!', callback_data='no'),
                   ]])
        sent = self.sender.sendMessage("Let's Vote ...", reply_markup=keyboard)

        self._ballot_box = {}
        self._keyboard_msg_ident = telepot.message_identifier(sent)
        self._editor = telepot.helper.Editor(self.bot, self._keyboard_msg_ident)

        # Generate an expiry event 30 seconds later
        self._expired_event = self.scheduler.event_later(30, ('_vote_expired', {'seconds': 30}))
Esempio n. 25
0
 def make_markup(a):
     first, second = a
     return InlineKeyboardMarkup(inline_keyboard=[[
         dict(text=second,
              callback_data=('/c{}m{}d{}'.format(cinema_id, movie_id,
                                                 day_id_m[second]))),
         dict(text=first,
              callback_data=('/c{}m{}d{}'.format(cinema_id, movie_id,
                                                 day_id_m[first]))),
         dict(text=settings.ANOTHER_DAY,
              callback_data=(
                  '/anytimec{}m{}d'.format(cinema_id, movie_id))),
     ]])
Esempio n. 26
0
    async def __make_prev_next_keyboard(self, prev_seq, next_seq):
        """Makes next/prev keyboard for paginated message."""
        inline_keyboard = []
        if len(prev_seq) > 0:
            inline_keyboard.append(
                InlineKeyboardButton(text="« prev",
                                     callback_data=self.serialize('p')))
        if len(next_seq) > 0:
            inline_keyboard.append(
                InlineKeyboardButton(text="next »",
                                     callback_data=self.serialize('n')))

        return InlineKeyboardMarkup(inline_keyboard=[inline_keyboard])
Esempio n. 27
0
def on_chat_message(msg):
    content_type, chat_type, chat_id = telepot.glance(msg)

    print(content_type, chat_type, chat_id)
    pprint(msg)
    keyboard = InlineKeyboardMarkup(inline_keyboard=[
        [InlineKeyboardButton(text="Ho fame", callback_data='press')],
        [InlineKeyboardButton(text="Ho sete", callback_data='press')],
    ])

    bot.sendMessage(
        chat_id, "Usa i pulsanti!",
        reply_markup=keyboard)  #oppure bot.sendMessage(chat_id, msg['text'])
Esempio n. 28
0
	def send_chooser(self, type, directory):
		print('send_chooser type: ' + str(type))
		self.set(type, directory)
		if type == TYPE_OPTIONS:
			self.bot.sendMessage(self.chat_id, 'Set options (ex: <code>--force -m 2500</code>)', parse_mode='HTML')
		elif not self.isEmpty(self.directory):
			file_list = self.show_files(self.directory)
			self.bot.sendMessage(self.chat_id, self.text_primary + file_list, parse_mode='HTML',
				reply_markup=InlineKeyboardMarkup(inline_keyboard=[[
					InlineKeyboardButton(text='Choose', callback_data='Chooser')
			]]))
		else:
			self.bot.sendMessage(self.chat_id, self.text_secondary)
Esempio n. 29
0
 def _show_next_state(self, message=None):
     winner = self._winner
     stop = self._stop
     if stop or winner:
         if winner:
             message = MESSAGES[winner]
         else:
             message = MESSAGES[0]
         self.editor.editMessageText(
             message,
             reply_markup=InlineKeyboardMarkup(inline_keyboard=[[
                 InlineKeyboardButton(text='НАЧАТЬ НОВУЮ',
                                      callback_data='start'),
             ]]))
     else:
         self.editor.editMessageText(
             message,
             reply_markup=InlineKeyboardMarkup(inline_keyboard=[[
                 InlineKeyboardButton(text=ICONS[c],
                                      callback_data='{}{}'.format(i, j))
                 for j, c in enumerate(line)
             ] for i, line in enumerate(self._matrix)]))
Esempio n. 30
0
 def _get_keyboard(self, buttons: list):
     if not buttons or len(buttons) == 0:
         return None
     telegram_buttons = []
     for button in buttons:
         if button['type'] == 'imBack':
             telegram_buttons.append([
                 InlineKeyboardButton(text=button['title'],
                                      callback_data=button['value'])
             ])
         #@TODO add button with link
     keyboard = InlineKeyboardMarkup(inline_keyboard=telegram_buttons)
     return keyboard