How to use Keyboard method in fMBT

Best Python code snippet using fMBT_python

inline.py

Source:inline.py Github

copy

Full Screen

1from Music.config import UPDATES_CHANNEL, ZAID_SUPPORT2from pyrogram.types import (3 CallbackQuery,4 InlineKeyboardButton,5 InlineKeyboardMarkup,6 InputMediaPhoto,7 Message,8)9def play_markup(videoid, user_id):10 buttons= [11 [12 InlineKeyboardButton(text="▶️", callback_data=f'resumevc2'),13 InlineKeyboardButton(text="⏸️", callback_data=f'pausevc2'),14 InlineKeyboardButton(text="⏭️", callback_data=f'skipvc2'),15 InlineKeyboardButton(text="⏹️", callback_data=f'stopvc2')16 ],17 [18 InlineKeyboardButton(text="🔎 ɢᴇᴛ ʟʏʀɪᴄꜱ", callback_data=f'lyrics {videoid}|{user_id}'),19 InlineKeyboardButton(text="🖱 ᴍᴇɴᴜ", callback_data=f'other {videoid}|{user_id}'),20 ],21 [22 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),23 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),24 ],25 [ 26 InlineKeyboardButton(text="🗑 ᴄʟᴏsᴇ", callback_data=f'close2')27 ],28 ]29 return buttons 30def others_markup(videoid, user_id):31 buttons= [32 [33 InlineKeyboardButton(text="✨ ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),34 InlineKeyboardButton(text="➕ Group Playlist", callback_data=f'group_playlist {videoid}|{user_id}')35 ],36 [37 InlineKeyboardButton(text="Get Audio", callback_data=f'gets audio|{videoid}|{user_id}'),38 InlineKeyboardButton(text="Get Video", callback_data=f'gets video|{videoid}|{user_id}')39 ],40 [41 InlineKeyboardButton(text="🔙", callback_data=f'goback {videoid}|{user_id}'),42 InlineKeyboardButton(text="🗑 Close", callback_data=f'close2')43 ],44 ]45 return buttons 46play_keyboard = InlineKeyboardMarkup(47 [48 [49 InlineKeyboardButton(50 "▶️", callback_data="resumevc"51 ),52 InlineKeyboardButton(53 "⏸️", callback_data="pausevc"54 ),55 InlineKeyboardButton(56 "⏭️", callback_data="skipvc"57 ),58 InlineKeyboardButton(59 "⏹️", callback_data="stopvc"60 )61 ],62 [63 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),64 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),65 ],66 [67 InlineKeyboardButton(68 "🗑", callback_data="close"69 )70 ] 71 ]72 )73def audio_markup(videoid, user_id):74 buttons= [75 [76 InlineKeyboardButton(text="▶️", callback_data=f'resumevc2'),77 InlineKeyboardButton(text="⏸️", callback_data=f'pausevc2'),78 InlineKeyboardButton(text="⏭️", callback_data=f'skipvc2'),79 InlineKeyboardButton(text="⏹️", callback_data=f'stopvc2')80 ],81 [82 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),83 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),84 ],85 [86 InlineKeyboardButton(text="🗑 Close", callback_data="close2") 87 ],88 ]89 return buttons 90def single_markup(ID, duration, user_id, query):91 buttons= [92 [93 InlineKeyboardButton(text="▶️ Start Playing", callback_data=f'Music {ID}|{duration}|{user_id}'),94 InlineKeyboardButton(text="🔎 Search More", callback_data=f'popat 1|{query}|{user_id}')95 ],96 [97 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),98 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),99 ],100 [101 InlineKeyboardButton(text="🗑 ᴄʟᴏsᴇ", callback_data=f"ppcl2 smex|{user_id}")102 ],103 ] 104 return buttons105def search_markup(ID1, ID2, ID3, ID4, ID5, duration1, duration2, duration3, duration4, duration5, user_id, query):106 buttons= [107 [108 InlineKeyboardButton(text="1️⃣", callback_data=f'Music {ID1}|{duration1}|{user_id}'),109 InlineKeyboardButton(text="2️⃣", callback_data=f'Music {ID2}|{duration2}|{user_id}'),110 InlineKeyboardButton(text="3️⃣", callback_data=f'Music {ID3}|{duration3}|{user_id}')111 ],112 [ 113 InlineKeyboardButton(text="4️⃣", callback_data=f'Music {ID4}|{duration4}|{user_id}'),114 InlineKeyboardButton(text="5️⃣", callback_data=f'Music {ID5}|{duration5}|{user_id}')115 ],116 [ 117 InlineKeyboardButton(text="🗑 ᴄʟᴏsᴇ", callback_data=f"ppcl2 smex|{user_id}") , 118 ],119 ]120 return buttons 121def search_markup2(ID6, ID7, ID8, ID9, ID10, duration6, duration7, duration8, duration9, duration10 ,user_id, query):122 buttons= [123 [124 InlineKeyboardButton(text="6️⃣", callback_data=f'Music {ID6}|{duration6}|{user_id}'),125 InlineKeyboardButton(text="7️⃣", callback_data=f'Music {ID7}|{duration7}|{user_id}'),126 InlineKeyboardButton(text="8️⃣", callback_data=f'Music {ID8}|{duration8}|{user_id}')127 ],128 [ 129 InlineKeyboardButton(text="9️⃣", callback_data=f'Music {ID9}|{duration9}|{user_id}'),130 InlineKeyboardButton(text="🔟", callback_data=f'Music {ID10}|{duration10}|{user_id}')131 ],132 [ 133 134 InlineKeyboardButton(text="🗑 Close", callback_data=f"ppcl2 smex|{user_id}") , 135 ],136 ]137 return buttons 138def personal_markup(link):139 buttons= [140 [141 InlineKeyboardButton(text="Watch on Youtube", url=f'{link}')142 ],143 [144 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),145 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),146 ],147 [ 148 InlineKeyboardButton(text="🗑 ᴄʟᴏsᴇ", callback_data=f'close2')149 ],150 ]151 return buttons 152 153start_keyboard = InlineKeyboardMarkup( 154 [155 [156 InlineKeyboardButton(157 "📜 Commands", url=""158 )159 ],160 [161 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),162 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),163 ],164 [165 InlineKeyboardButton(166 "🗑 ᴄʟᴏsᴇ", callback_data="close2"167 )168 ] 169 ]170 )171 172confirm_keyboard = InlineKeyboardMarkup( 173 [174 [175 InlineKeyboardButton(176 "Yes", callback_data="cbdel"177 ),178 InlineKeyboardButton(179 "No", callback_data="close2"180 )181 ],182 [183 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),184 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),185 ], 186 ]187 )188confirm_group_keyboard = InlineKeyboardMarkup( 189 [190 [191 InlineKeyboardButton(192 "Yes", callback_data="cbgroupdel"193 ),194 InlineKeyboardButton(195 "No", callback_data="close2"196 )197 ],198 [199 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),200 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),201 ], 202 ]203 )204close_keyboard = InlineKeyboardMarkup( 205 [206 [207 InlineKeyboardButton(208 "🗑 Close", callback_data="close2"209 )210 ] 211 ]212 )213play_list_keyboard = InlineKeyboardMarkup( 214 [215 [216 InlineKeyboardButton(217 "Personal Playlist", callback_data="P_list"218 ),219 InlineKeyboardButton(220 "Group's Playlist", callback_data="G_list"221 )222 ],223 [224 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),225 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),226 ],227 [228 InlineKeyboardButton(229 "🗑 ᴄʟᴏsᴇ", callback_data="close2"230 )231 ]232 ]233 )234def playlist_markup(user_name, user_id):235 buttons= [236 [237 InlineKeyboardButton(text=f"Group's Playlist", callback_data=f'play_playlist {user_id}|group'),238 InlineKeyboardButton(text=f"{user_name[:8]}'s Playlist", callback_data=f'play_playlist {user_id}|personal'),239 ],240 [241 InlineKeyboardButton(text=f"✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{ZAID_SUPPORT}"),242 InlineKeyboardButton(text=f"📣 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"),243 ],244 [245 InlineKeyboardButton(text="🗑 Close", callback_data="close2") 246 ],247 ]...

Full Screen

Full Screen

replykeyboardmarkup.py

Source:replykeyboardmarkup.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# A library that provides a Python interface to the Telegram Bot API4# Copyright (C) 2015-20205# Leandro Toledo de Souza <devs@python-telegram-bot.org>6#7# This program is free software: you can redistribute it and/or modify8# it under the terms of the GNU Lesser Public License as published by9# the Free Software Foundation, either version 3 of the License, or10# (at your option) any later version.11#12# This program is distributed in the hope that it will be useful,13# but WITHOUT ANY WARRANTY; without even the implied warranty of14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# GNU Lesser Public License for more details.16#17# You should have received a copy of the GNU Lesser Public License18# along with this program. If not, see [http://www.gnu.org/licenses/].19"""This module contains an object that represents a Telegram ReplyKeyboardMarkup."""20from telegram import ReplyMarkup21class ReplyKeyboardMarkup(ReplyMarkup):22 """This object represents a custom keyboard with reply options.23 Attributes:24 keyboard (List[List[:class:`telegram.KeyboardButton` | :obj:`str`]]): Array of button rows.25 resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard.26 one_time_keyboard (:obj:`bool`): Optional. Requests clients to hide the keyboard as soon as27 it's been used.28 selective (:obj:`bool`): Optional. Show the keyboard to specific users only.29 Example:30 A user requests to change the bot's language, bot replies to the request with a keyboard31 to select the new language. Other users in the group don't see the keyboard.32 Args:33 keyboard (List[List[:obj:`str` | :class:`telegram.KeyboardButton`]]): Array of button rows,34 each represented by an Array of :class:`telegram.KeyboardButton` objects.35 resize_keyboard (:obj:`bool`, optional): Requests clients to resize the keyboard vertically36 for optimal fit (e.g., make the keyboard smaller if there are just two rows of37 buttons). Defaults to false, in which case the custom keyboard is always of the same38 height as the app's standard keyboard. Defaults to ``False``39 one_time_keyboard (:obj:`bool`, optional): Requests clients to hide the keyboard as soon as40 it's been used. The keyboard will still be available, but clients will automatically41 display the usual letter-keyboard in the chat - the user can press a special button in42 the input field to see the custom keyboard again. Defaults to ``False``.43 selective (:obj:`bool`, optional): Use this parameter if you want to show the keyboard to44 specific users only. Targets:45 1) users that are @mentioned in the text of the Message object46 2) if the bot's message is a reply (has reply_to_message_id), sender of the original47 message.48 Defaults to ``False``.49 **kwargs (:obj:`dict`): Arbitrary keyword arguments.50 """51 def __init__(self,52 keyboard,53 resize_keyboard=False,54 one_time_keyboard=False,55 selective=False,56 **kwargs):57 # Required58 self.keyboard = keyboard59 # Optionals60 self.resize_keyboard = bool(resize_keyboard)61 self.one_time_keyboard = bool(one_time_keyboard)62 self.selective = bool(selective)63 def to_dict(self):64 data = super().to_dict()65 data['keyboard'] = []66 for row in self.keyboard:67 r = []68 for button in row:69 if hasattr(button, 'to_dict'):70 r.append(button.to_dict()) # telegram.KeyboardButton71 else:72 r.append(button) # str73 data['keyboard'].append(r)74 return data75 @classmethod76 def from_button(cls,77 button,78 resize_keyboard=False,79 one_time_keyboard=False,80 selective=False,81 **kwargs):82 """Shortcut for::83 ReplyKeyboardMarkup([[button]], **kwargs)84 Return an ReplyKeyboardMarkup from a single KeyboardButton85 Args:86 button (:class:`telegram.KeyboardButton` | :obj:`str`): The button to use in the markup87 resize_keyboard (:obj:`bool`, optional): Requests clients to resize the keyboard88 vertically for optimal fit (e.g., make the keyboard smaller if there are just two89 rows of buttons). Defaults to false, in which case the custom keyboard is always of90 the same height as the app's standard keyboard.91 Defaults to ``False``92 one_time_keyboard (:obj:`bool`, optional): Requests clients to hide the keyboard as93 soon as it's been used. The keyboard will still be available, but clients will94 automatically display the usual letter-keyboard in the chat - the user can press95 a special button in the input field to see the custom keyboard again.96 Defaults to ``False``.97 selective (:obj:`bool`, optional): Use this parameter if you want to show the keyboard98 to specific users only. Targets:99 1) users that are @mentioned in the text of the Message object100 2) if the bot's message is a reply (has reply_to_message_id), sender of the101 original message.102 Defaults to ``False``.103 **kwargs (:obj:`dict`): Arbitrary keyword arguments.104 """105 return cls([[button]],106 resize_keyboard=resize_keyboard,107 one_time_keyboard=one_time_keyboard,108 selective=selective,109 **kwargs)110 @classmethod111 def from_row(cls,112 button_row,113 resize_keyboard=False,114 one_time_keyboard=False,115 selective=False,116 **kwargs):117 """Shortcut for::118 ReplyKeyboardMarkup([button_row], **kwargs)119 Return an ReplyKeyboardMarkup from a single row of KeyboardButtons120 Args:121 button_row (List[:class:`telegram.KeyboardButton` | :obj:`str`]): The button to use in122 the markup123 resize_keyboard (:obj:`bool`, optional): Requests clients to resize the keyboard124 vertically for optimal fit (e.g., make the keyboard smaller if there are just two125 rows of buttons). Defaults to false, in which case the custom keyboard is always of126 the same height as the app's standard keyboard.127 Defaults to ``False``128 one_time_keyboard (:obj:`bool`, optional): Requests clients to hide the keyboard as129 soon as it's been used. The keyboard will still be available, but clients will130 automatically display the usual letter-keyboard in the chat - the user can press131 a special button in the input field to see the custom keyboard again.132 Defaults to ``False``.133 selective (:obj:`bool`, optional): Use this parameter if you want to show the keyboard134 to specific users only. Targets:135 1) users that are @mentioned in the text of the Message object136 2) if the bot's message is a reply (has reply_to_message_id), sender of the137 original message.138 Defaults to ``False``.139 **kwargs (:obj:`dict`): Arbitrary keyword arguments.140 """141 return cls([button_row],142 resize_keyboard=resize_keyboard,143 one_time_keyboard=one_time_keyboard,144 selective=selective,145 **kwargs)146 @classmethod147 def from_column(cls,148 button_column,149 resize_keyboard=False,150 one_time_keyboard=False,151 selective=False,152 **kwargs):153 """Shortcut for::154 ReplyKeyboardMarkup([[button] for button in button_column], **kwargs)155 Return an ReplyKeyboardMarkup from a single column of KeyboardButtons156 Args:157 button_column (List[:class:`telegram.KeyboardButton` | :obj:`str`]): The button to use158 in the markup159 resize_keyboard (:obj:`bool`, optional): Requests clients to resize the keyboard160 vertically for optimal fit (e.g., make the keyboard smaller if there are just two161 rows of buttons). Defaults to false, in which case the custom keyboard is always of162 the same height as the app's standard keyboard.163 Defaults to ``False``164 one_time_keyboard (:obj:`bool`, optional): Requests clients to hide the keyboard as165 soon as it's been used. The keyboard will still be available, but clients will166 automatically display the usual letter-keyboard in the chat - the user can press167 a special button in the input field to see the custom keyboard again.168 Defaults to ``False``.169 selective (:obj:`bool`, optional): Use this parameter if you want to show the keyboard170 to specific users only. Targets:171 1) users that are @mentioned in the text of the Message object172 2) if the bot's message is a reply (has reply_to_message_id), sender of the173 original message.174 Defaults to ``False``.175 **kwargs (:obj:`dict`): Arbitrary keyword arguments.176 """177 button_grid = [[button] for button in button_column]178 return cls(button_grid,179 resize_keyboard=resize_keyboard,180 one_time_keyboard=one_time_keyboard,181 selective=selective,...

Full Screen

Full Screen

keyboards.py

Source:keyboards.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3@author: pablo4"""5from telegram import InlineKeyboardButton, InlineKeyboardMarkup6from collections import namedtuple7import const as c8indiciAulee = namedtuple("indiciAulee", "field1 field2")9i0 = indiciAulee(field1='Posti studio atrio primo piano', field2=0)10i1 = indiciAulee(field1='Posti studio atrio secondo piano', field2=1)11i2 = indiciAulee(field1='Posti studio corridoi antichistica secondo piano', field2=2)12i3 = indiciAulee(field1='Posti studio corridoio lingue primo piano', field2=3)13i4 = indiciAulee(field1='Posti studio corridoio linguistica secondo piano', field2=4)14i5 = indiciAulee(field1='Posti studio corridoio neolatine piano terra', field2=5)15i6 = indiciAulee(field1='Posti studio corridoio paleografia primo piano', field2=6)16i7 = indiciAulee(field1='Posti studio Sala A secondo piano', field2=7)17i8 = indiciAulee(field1='Posti studio Sala C secondo piano', field2=8)18i9 = indiciAulee(field1='Posti studio Sala D secondo piano', field2=9)19i10 = indiciAulee(field1='Posti studio SALA M primo piano', field2=10)20i11 = indiciAulee(field1='Sala archeologia', field2=11)21i12 = indiciAulee(field1='Sala CEDAF', field2=12)22i13 = indiciAulee(field1='Sala dialettologia', field2=13)23i14 = indiciAulee(field1='Sala E secondo piano', field2=14)24i15 = indiciAulee(field1='Sala filologia classica-storia antica', field2=15)25i16 = indiciAulee(field1='Sala filosofia 1', field2=16)26i17 = indiciAulee(field1='Sala filosofia 2', field2=17)27i18 = indiciAulee(field1='Sala francese', field2=18)28i19 = indiciAulee(field1='Sala germanistica', field2=19)29i20 = indiciAulee(field1='Sala italianistica e spettacolo', field2=20)30i21 = indiciAulee(field1='Sala lingue straniere', field2=21)31i22 = indiciAulee(field1='Sala linguistica', field2=22)32i23 = indiciAulee(field1='Sala medioevo e rinascimento', field2=23)33i24 = indiciAulee(field1='Sala orientalistica', field2=24)34i25 = indiciAulee(field1='Sala riviste linguistica', field2=25)35i26 = indiciAulee(field1='Sala russo', field2=26)36i27 = indiciAulee(field1='Sala scandinavistica', field2=27)37i28 = indiciAulee(field1='Sala slavistica', field2=28)38i29 = indiciAulee(field1='Sala spagnolo 1', field2=29)39i30 = indiciAulee(field1='Sala spagnolo 2', field2=30)40i31 = indiciAulee(field1='Sala storia', field2=31)41indici = [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23,42 i24, i25, i26, i27, i28, i29, i30, i31]43halls = ['Posti studio atrio primo piano', 'Posti studio atrio secondo piano',44 'Posti studio corridoi antichistica secondo piano', 'Posti studio corridoio lingue primo piano',45 'Posti studio corridoio linguistica secondo piano',46 'Posti studio corridoio neolatine piano terra', 'Posti studio corridoio paleografia primo piano',47 'Posti studio Sala A secondo piano', 'Posti studio Sala C secondo piano', 'Posti studio Sala D secondo piano',48 'Posti studio SALA M primo piano', 'Sala archeologia', 'Sala CEDAF', 'Sala dialettologia',49 'Sala E secondo piano', 'Sala filologia classica-storia antica', 'Sala filosofia 1', 'Sala filosofia 2',50 'Sala francese', 'Sala germanistica',51 'Sala italianistica e spettacolo', 'Sala lingue straniere', 'Sala linguistica', 'Sala medioevo e rinascimento',52 'Sala orientalistica', 'Sala riviste linguistica', 'Sala russo', 'Sala scandinavistica', 'Sala slavistica',53 'Sala spagnolo 1', 'Sala spagnolo 2', 'Sala storia']54halls_buttons = [55 [InlineKeyboardButton(halls[0], callback_data='0')],56 [InlineKeyboardButton(halls[1], callback_data='1')],57 [InlineKeyboardButton(halls[2], callback_data='2')],58 [InlineKeyboardButton(halls[3], callback_data='3')],59 [InlineKeyboardButton(halls[4], callback_data='4')],60 [InlineKeyboardButton(halls[5], callback_data='5')],61 [InlineKeyboardButton(halls[6], callback_data='6')],62 [InlineKeyboardButton(halls[7], callback_data='7')],63 [InlineKeyboardButton(halls[8], callback_data='8')],64 [InlineKeyboardButton(halls[9], callback_data='9')],65 [InlineKeyboardButton(halls[10], callback_data='10')],66 [InlineKeyboardButton(halls[11], callback_data='11')],67 [InlineKeyboardButton(halls[12], callback_data='12')],68 [InlineKeyboardButton(halls[13], callback_data='13')],69 [InlineKeyboardButton(halls[14], callback_data='14')],70 [InlineKeyboardButton(halls[15], callback_data='15')],71 [InlineKeyboardButton(halls[16], callback_data='16')],72 [InlineKeyboardButton(halls[17], callback_data='17')],73 [InlineKeyboardButton(halls[18], callback_data='18')],74 [InlineKeyboardButton(halls[19], callback_data='19')],75 [InlineKeyboardButton(halls[20], callback_data='20')],76 [InlineKeyboardButton(halls[21], callback_data='21')],77 [InlineKeyboardButton(halls[22], callback_data='22')],78 [InlineKeyboardButton(halls[23], callback_data='23')],79 [InlineKeyboardButton(halls[24], callback_data='24')],80 [InlineKeyboardButton(halls[25], callback_data='25')],81 [InlineKeyboardButton(halls[26], callback_data='26')],82 [InlineKeyboardButton(halls[27], callback_data='27')],83 [InlineKeyboardButton(halls[28], callback_data='28')],84 [InlineKeyboardButton(halls[29], callback_data='29')],85 [InlineKeyboardButton(halls[30], callback_data='30')],86 [InlineKeyboardButton(halls[31], callback_data='31')]87]88MENU = 089buttons = [90 InlineKeyboardButton("Scelta Aula", callback_data=str(c.COLLECT_HALL_INFO)), #091 InlineKeyboardButton("Cambio data", callback_data=str(c.BOOK)), #192 InlineKeyboardButton("Disponibilità aulee", callback_data=str(c.SEATS_LEFT)), #293 InlineKeyboardButton("Arresta Bot", callback_data=str(c.END)), #394 InlineKeyboardButton("Torna al Main Menu", callback_data=str(c.BACK)), #495 InlineKeyboardButton("Iscriviti", callback_data=str(c.SELF_SUB)), #596 InlineKeyboardButton("Iscrivi qualcuno", callback_data=str(c.NEW_SUB)), #697 InlineKeyboardButton("Modifica iscrizione", callback_data=str(c.MODIFY)), #798 InlineKeyboardButton("Prenota", callback_data=str(c.BOOK)), #899 InlineKeyboardButton("Iscrizione", callback_data=str(c.SUB)), #9100 InlineKeyboardButton("Elimina iscrizione", callback_data=str(c.DELETE_SUB)), #10101 InlineKeyboardButton("Info iscrizione", callback_data=str(c.SHOW_INFO)), #11102 InlineKeyboardButton("Torna indietro", callback_data=str(c.BACK)), #12103 InlineKeyboardButton("Conferma aula", callback_data=str(c.CONFIRM_HALL)), #13104 InlineKeyboardButton("Cambia aula", callback_data=str(c.CHANGE_HALL)), #14105 InlineKeyboardButton("Registrati", callback_data=str(c.COMPLETE_SUB)), #15106 InlineKeyboardButton("Modifica dati", callback_data=str(c.CHANGE_HALL)), #16107 InlineKeyboardButton("Ritorna al menu", callback_data=str(c.SUB_MENU)), #17108 InlineKeyboardButton("Ritorna al Main Menu", callback_data=str(c.BACK)), #18109 InlineKeyboardButton("Ritorna al Main Menu", callback_data=str(c.RESTART)), #19110 InlineKeyboardButton("Riprova", callback_data=str(c.DELETE_SUB)), #20111 InlineKeyboardButton("Torna indietro", callback_data=str(c.SUB_MENU)), #21112]113custom_keyboard1 = [buttons[0], buttons[1], buttons[2], buttons[3], buttons[4]]114custom_keyboard2 = [buttons[8], buttons[9], buttons[10], buttons[11], buttons[3]] #main menu keyboard115custom_keyboard3 = [buttons[5], buttons[6], buttons[7], buttons[3], buttons[4]] #sub keyboard116custom_keyboard4 = [buttons[13], buttons[14], buttons[21]] #hall confirmation keyboard117custom_keyboard5 = [buttons[15], buttons[16], buttons[17]]118custom_keyboard6 = [buttons[8], buttons[16], buttons[4]]119custom_keyboard7 = [buttons[20], buttons[4], buttons[3]]120custom_keyboard8 = [buttons[18], buttons[3]]121custom_keyboard9 = [buttons[13], buttons[14], buttons[12]]122custom_keyboard10 = [buttons[7], buttons[3], buttons[4]]123def build_menu(buttonss, n_cols, header_buttons=None, footer_buttons=None):124 menu = [buttonss[i:i + n_cols] for i in range(0, len(buttonss), n_cols)]125 if header_buttons:126 menu.insert(0, [header_buttons])127 if footer_buttons:128 menu.append([footer_buttons])129 return menu130initial_keyboard = InlineKeyboardMarkup(build_menu(custom_keyboard2, n_cols=2), resize_keyboard=True)131subHallConfirmationKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard4, n_cols=2), resize_keyboard=True)132bookHallConfirmationKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard9, n_cols=2), resize_keyboard=True)133subConfirmationKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard5, n_cols=2), resize_keyboard=True)134bookConfirmationKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard6, n_cols=2), resize_keyboard=True)135idNotFoundKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard7, n_cols=2), resize_keyboard=True)136completedActionKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard8, n_cols=1), resize_keyboard=True)137dateConfirmationKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard1, n_cols=2), resize_keyboard=True)138hallsKeyboard = InlineKeyboardMarkup(halls_buttons)139subKeyboard = InlineKeyboardMarkup(build_menu(custom_keyboard3, n_cols=2), resize_keyboard=True)...

Full Screen

Full Screen

MarkUp.py

Source:MarkUp.py Github

copy

Full Screen

1from telebot.types import InlineKeyboardMarkup2from telebot.types import InlineKeyboardButton3class MarkUp:4 def gen_markup(self):5 markup = InlineKeyboardMarkup()6 markup.row_width = 77 markup.add(InlineKeyboardButton("About Me 📝", callback_data="about"))8 markup.add(InlineKeyboardButton("Knowledge 🧠", callback_data="knowledge"))9 markup.add(InlineKeyboardButton("Resume 📇", callback_data="resume"))10 markup.add(InlineKeyboardButton("Social Media 📲", callback_data="media"))11 markup.add(InlineKeyboardButton("Contact Me ☎️", callback_data="cont"))12 markup.add(InlineKeyboardButton("WebSite 🧑‍💻", callback_data="site"))13 markup.add(InlineKeyboardButton("Desires 🎯", callback_data="work"))14 markup.add(InlineKeyboardButton("🇮🇱 Change Language 🇺🇸", callback_data="setLan"))15 markup.add(InlineKeyboardButton("I Want To Quit 👋", callback_data="bye"))16 return markup17 def gen_markup_media(self):18 markup = InlineKeyboardMarkup()19 markup.row_width = 620 markup.add(InlineKeyboardButton("GitHub", callback_data="git"))21 markup.add(InlineKeyboardButton("LinkedIn", callback_data="link"))22 markup.add(InlineKeyboardButton("Telegram", callback_data="telegram"))23 markup.add(InlineKeyboardButton("Instagram", callback_data="insta"))24 markup.add(InlineKeyboardButton("Facebook", callback_data="facebook"))25 markup.add(InlineKeyboardButton("Return To Menu 🔁", callback_data="return"))26 return markup27 def gen_markup_contact(self):28 markup = InlineKeyboardMarkup()29 markup.row_width = 430 markup.add(InlineKeyboardButton("Email 📧", callback_data="email"))31 markup.add(InlineKeyboardButton("WhatsApp", callback_data="whatsapp"))32 markup.add(InlineKeyboardButton("Phone 📱", callback_data="Phone"))33 markup.add(InlineKeyboardButton("Return To Menu 🔁", callback_data="return"))34 return markup35 def set_markup_return_menu(self):36 markup = InlineKeyboardMarkup()37 markup.row_width = 138 markup.add(InlineKeyboardButton("Return To Menu 🔁", callback_data="return"))39 return markup40 def set_markup_return_social_menu(self):41 markup = InlineKeyboardMarkup()42 markup.row_width = 143 markup.add(InlineKeyboardButton("Return To Media Menu 🔁", callback_data="return_media"))44 return markup45 def create_markup(self,string,callback_data):46 markup = InlineKeyboardMarkup()47 markup.row_width = 148 markup.add(InlineKeyboardButton(string, callback_data=callback_data))49 return markup50 def create_inline_keyboard_btn(self, string, url):51 markup = InlineKeyboardMarkup()52 markup.row_width = 253 markup.add(InlineKeyboardButton(text=string, callback_data='return', url=url))54 markup.add(InlineKeyboardButton("Return To Menu 🔁", callback_data="return"))55 return markup56 def create_inline_keyboard_btn_media(self, string, url):57 markup = InlineKeyboardMarkup()58 markup.row_width = 259 markup.add(InlineKeyboardButton(text=string, url=url))60 markup.add(InlineKeyboardButton("Return To Media Menu 🔁", callback_data="return_media"))61 return markup62 def create_inline_keyboard_btn_contact(self, string, url):63 markup = InlineKeyboardMarkup()64 markup.row_width = 265 markup.add(InlineKeyboardButton(text=string, url=url))66 markup.add(InlineKeyboardButton("Return To Contact Menu 🔁", callback_data="return_cont"))67 return markup68####################################################################69######################## Hebrew MarkUps ############################70 def gen_markup_hb(self):71 markup = InlineKeyboardMarkup()72 markup.row_width = 773 markup.add(InlineKeyboardButton("קצת עליי 📝", callback_data="a"))74 markup.add(InlineKeyboardButton("הידע שלי 🧠", callback_data="k"))75 markup.add(InlineKeyboardButton("קורות חיים 📇", callback_data="r"))76 markup.add(InlineKeyboardButton("מדיה חברתית 📲", callback_data="m"))77 markup.add(InlineKeyboardButton("צור קשר ☎️", callback_data="c"))78 markup.add(InlineKeyboardButton("האתר שלי 🧑‍💻", callback_data="s"))79 markup.add(InlineKeyboardButton("שאיפות 🎯", callback_data="w"))80 markup.add(InlineKeyboardButton("🇮🇱 שנה שפה 🇺🇸", callback_data="set"))81 markup.add(InlineKeyboardButton("רוצה לצאת? 👋", callback_data="b"))82 return markup83 def gen_markup_media_hb(self):84 markup = InlineKeyboardMarkup()85 markup.row_width = 686 markup.add(InlineKeyboardButton("גיטהאב", callback_data="g"))87 markup.add(InlineKeyboardButton("לינקדאין", callback_data="l"))88 markup.add(InlineKeyboardButton("טלגרם", callback_data="t"))89 markup.add(InlineKeyboardButton("אינסטגרם", callback_data="i"))90 markup.add(InlineKeyboardButton("פייסבוק", callback_data="f"))91 markup.add(InlineKeyboardButton("חזרה לתפריט הראשי 🔁", callback_data="ret"))92 return markup93 def gen_markup_contact_hb(self):94 markup = InlineKeyboardMarkup()95 markup.row_width = 496 markup.add(InlineKeyboardButton("אימייל 📧", callback_data="e"))97 markup.add(InlineKeyboardButton("וואטסאפ", callback_data="what"))98 markup.add(InlineKeyboardButton("טלפון 📱", callback_data="P"))99 markup.add(InlineKeyboardButton("חזרה לתפריט הראשי 🔁", callback_data="ret"))100 return markup101 def set_markup_return_menu_hb(self):102 markup = InlineKeyboardMarkup()103 markup.row_width = 1104 markup.add(InlineKeyboardButton("חזרה לתפריט הראשי 🔁", callback_data="ret"))105 return markup106 def set_markup_return_social_menu_hb(self):107 markup = InlineKeyboardMarkup()108 markup.row_width = 1109 markup.add(InlineKeyboardButton("חזרה לתפריט המדיה 🔁", callback_data="ret_media"))110 return markup111 def create_markup_hb(self,string,callback_data):112 markup = InlineKeyboardMarkup()113 markup.row_width = 1114 markup.add(InlineKeyboardButton(string, callback_data=callback_data))115 return markup116 def create_inline_keyboard_btn_hb(self, string, url):117 markup = InlineKeyboardMarkup()118 markup.row_width = 2119 markup.add(InlineKeyboardButton(text=string, callback_data='ret', url=url))120 markup.add(InlineKeyboardButton("חזרה לתפריט הראשי 🔁", callback_data="ret"))121 return markup122 def create_inline_keyboard_btn_media_hb(self, string, url):123 markup = InlineKeyboardMarkup()124 markup.row_width = 2125 markup.add(InlineKeyboardButton(text=string, url=url))126 markup.add(InlineKeyboardButton("חזרה לתפריט המדיה 🔁", callback_data="ret_media"))127 return markup128 def create_inline_keyboard_btn_contact_hb(self, string, url):129 markup = InlineKeyboardMarkup()130 markup.row_width = 2131 markup.add(InlineKeyboardButton(text=string, url=url))132 markup.add(InlineKeyboardButton("חזרה לתפריט יצירת הקשר 🔁", callback_data="ret_cont"))133 return markup134 def create_hb_en_btn(self):135 markup = InlineKeyboardMarkup()136 markup.row_width = 2137 markup.add(InlineKeyboardButton("עברית 🇮🇱", callback_data="hebrew"))138 markup.add(InlineKeyboardButton("English 🇺🇸", callback_data="english"))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful