How to use Keyboard method in redwood

Best JavaScript code snippet using redwood

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

keynames.py

Source:keynames.py Github

copy

Full Screen

1key_names = {2 'A': 0x04, # Keyboard a and A3 'B': 0x05, # Keyboard b and B4 'C': 0x06, # Keyboard c and C5 'D': 0x07, # Keyboard d and D6 'E': 0x08, # Keyboard e and E7 'F': 0x09, # Keyboard f and F8 'G': 0x0a, # Keyboard g and G9 'H': 0x0b, # Keyboard h and H10 'I': 0x0c, # Keyboard i and I11 'J': 0x0d, # Keyboard j and J12 'K': 0x0e, # Keyboard k and K13 'L': 0x0f, # Keyboard l and L14 'M': 0x10, # Keyboard m and M15 'N': 0x11, # Keyboard n and N16 'O': 0x12, # Keyboard o and O17 'P': 0x13, # Keyboard p and P18 'Q': 0x14, # Keyboard q and Q19 'R': 0x15, # Keyboard r and R20 'S': 0x16, # Keyboard s and S21 'T': 0x17, # Keyboard t and T22 'U': 0x18, # Keyboard u and U23 'V': 0x19, # Keyboard v and V24 'W': 0x1a, # Keyboard w and W25 'X': 0x1b, # Keyboard x and X26 'Y': 0x1c, # Keyboard y and Y27 'Z': 0x1d, # Keyboard z and Z28 '1': 0x1e, # Keyboard 1 and !29 '2': 0x1f, # Keyboard 2 and @30 '3': 0x20, # Keyboard 3 and #31 '4': 0x21, # Keyboard 4 and $32 '5': 0x22, # Keyboard 5 and %33 '6': 0x23, # Keyboard 6 and ^34 '7': 0x24, # Keyboard 7 and &35 '8': 0x25, # Keyboard 8 and *36 '9': 0x26, # Keyboard 9 and (37 '0': 0x27, # Keyboard 0 and )38 'ENTER': 0x28, # Keyboard Return (ENTER)39 'ESC': 0x29, # Keyboard ESCAPE40 'ESCAPE': 0x29, # Keyboard ESCAPE41 'BACKSPACE': 0x2a, # Keyboard DELETE (Backspace)42 'TAB': 0x2b, # Keyboard Tab43 'SPACE': 0x2c, # Keyboard Spacebar44 'LEFTBRACE': 0x2f, # Keyboard [ and {45 'LEFTBRACKET': 0x2f, # Keyboard [ and {46 'MINUS': 0x2d, # Keyboard - and _47 'EQUAL': 0x2e, # Keyboard = and +48 'EQUALS': 0x2e, # Keyboard = and +49 'PLUS': 0x2e, # Keyboard = and +50 'RIGHTBRACE': 0x30, # Keyboard ] and }51 'RIGHTBRACKET': 0x30, # Keyboard ] and }52 'BACKSLASH': 0x31, # Keyboard \ and |53 'HASHTILDE': 0x32, # Keyboard Non-US # and ~54 'HASHANDTILDE': 0x32, # Keyboard Non-US # and ~55 'SEMICOLON': 0x33, # Keyboard ; and :56 'APOSTROPHE': 0x34, # Keyboard ' and "57 'QUOTE': 0x34, # Keyboard ' and "58 'GRAVE': 0x35, # Keyboard ` and ~59 'BACKTICK': 0x35, # Keyboard ` and ~60 'TILDE': 0x35, # Keyboard ` and ~61 'COMMA': 0x36, # Keyboard , and <62 'DOT': 0x37, # Keyboard . and >63 'PERIOD': 0x37, # Keyboard . and >64 'SLASH': 0x38, # Keyboard / and ?65 'FORWARDSLASH': 0x38, # Keyboard / and ?66 'CAPSLOCK': 0x39, # Keyboard Caps Lock67 'F1': 0x3a, # Keyboard F168 'F2': 0x3b, # Keyboard F269 'F3': 0x3c, # Keyboard F370 'F4': 0x3d, # Keyboard F471 'F5': 0x3e, # Keyboard F572 'F6': 0x3f, # Keyboard F673 'F7': 0x40, # Keyboard F774 'F8': 0x41, # Keyboard F875 'F9': 0x42, # Keyboard F976 'F10': 0x43, # Keyboard F1077 'F11': 0x44, # Keyboard F1178 'F12': 0x45, # Keyboard F1279 'SYSRQ': 0x46, # Keyboard Print Screen80 'SCROLLLOCK': 0x47, # Keyboard Scroll Lock81 'PAUSE': 0x48, # Keyboard Pause82 'INSERT': 0x49, # Keyboard Insert83 'HOME': 0x4a, # Keyboard Home84 'PAGEUP': 0x4b, # Keyboard Page Up85 'DELETE': 0x4c, # Keyboard Delete Forward86 'END': 0x4d, # Keyboard End87 'PAGEDOWN': 0x4e, # Keyboard Page Down88 'RIGHT': 0x4f, # Keyboard Right Arrow89 'RIGHTARROW': 0x4f, # Keyboard Right Arrow90 'LEFT': 0x50, # Keyboard Left Arrow91 'LEFTARROW': 0x50, # Keyboard Left Arrow92 'DOWN': 0x51, # Keyboard Down Arrow93 'DOWNARROW': 0x51, # Keyboard Down Arrow94 'UP': 0x52, # Keyboard Up Arrow95 'UPARROW': 0x52, # Keyboard Up Arrow96 'NUMLOCK': 0x53, # Keyboard Num Lock and Clear97 'KPSLASH': 0x54, # Keypad /98 'NUMPADSLASH': 0x54, # Keypad /99 'KPASTERISK': 0x55, # Keypad *100 'NUMPADASTERISK': 0x55, # Keypad *101 'NUMPADTIMES': 0x55, # Keypad *102 'KPMINUS': 0x56, # Keypad -103 'NUMPADMINUS': 0x56, # Keypad -104 'KPPLUS': 0x57, # Keypad +105 'NUMPADPLUS': 0x57, # Keypad +106 'KPENTER': 0x58, # Keypad ENTER107 'NUMPADENTER': 0x58, # Keypad ENTER108 'KP1': 0x59, # Keypad 1 and End109 'NUMPAD1': 0x59, # Keypad 1 and End110 'KP2': 0x5a, # Keypad 2 and Down Arrow111 'NUMPAD2': 0x5a, # Keypad 2 and Down Arrow112 'KP3': 0x5b, # Keypad 3 and PageDn113 'NUMPAD3': 0x5b, # Keypad 3 and PageDn114 'KP4': 0x5c, # Keypad 4 and Left Arrow115 'NUMPAD4': 0x5c, # Keypad 4 and Left Arrow116 'KP5': 0x5d, # Keypad 5117 'NUMPAD5': 0x5d, # Keypad 5118 'KP6': 0x5e, # Keypad 6 and Right Arrow119 'NUMPAD6': 0x5e, # Keypad 6 and Right Arrow120 'KP7': 0x5f, # Keypad 7 and Home121 'NUMPAD7': 0x5f, # Keypad 7 and Home122 'KP8': 0x60, # Keypad 8 and Up Arrow123 'NUMPAD8': 0x60, # Keypad 8 and Up Arrow124 'KP9': 0x61, # Keypad 9 and Page Up125 'NUMPAD9': 0x61, # Keypad 9 and Page Up126 'KP0': 0x62, # Keypad 0 and Insert127 'NUMPAD0': 0x62, # Keypad 0 and Insert128 'KPDOT': 0x63, # Keypad . and Delete129 'NUMPADDOT': 0x63, # Keypad . and Delete130 '102ND': 0x64, # Keyboard Non-US \ and |131 'COMPOSE': 0x65, # Keyboard Application132 'POWER': 0x66, # Keyboard Power133 'KPEQUAL': 0x67, # Keypad =134 'NUMPADEQUAL': 0x67, # Keypad =135 'NUMPADEQUALS': 0x67, # Keypad =136 'F13': 0x68, # Keyboard F13137 'F14': 0x69, # Keyboard F14138 'F15': 0x6a, # Keyboard F15139 'F16': 0x6b, # Keyboard F16140 'F17': 0x6c, # Keyboard F17141 'F18': 0x6d, # Keyboard F18142 'F19': 0x6e, # Keyboard F19143 'F20': 0x6f, # Keyboard F20144 'F21': 0x70, # Keyboard F21145 'F22': 0x71, # Keyboard F22146 'F23': 0x72, # Keyboard F23147 'F24': 0x73, # Keyboard F24148 'OPEN': 0x74, # Keyboard Execute149 'HELP': 0x75, # Keyboard Help150 'PROPS': 0x76, # Keyboard Menu151 'FRONT': 0x77, # Keyboard Select152 'STOP': 0x78, # Keyboard Stop153 'AGAIN': 0x79, # Keyboard Again154 'UNDO': 0x7a, # Keyboard Undo155 'CUT': 0x7b, # Keyboard Cut156 'COPY': 0x7c, # Keyboard Copy157 'PASTE': 0x7d, # Keyboard Paste158 'FIND': 0x7e, # Keyboard Find159 'MUTE': 0x7f, # Keyboard Mute160 'VOLUMEUP': 0x80, # Keyboard Volume Up161 'VOLUMEDOWN': 0x81, # Keyboard Volume Down162 'KPCOMMA': 0x85, # Keypad Comma163 'KEYPAD EQUAL': 0x86, # Keypad Equal Sign164 'RO': 0x87, # Keyboard International1165 'KATAKANAHIRAGANA': 0x88, # Keyboard International2166 'YEN': 0x89, # Keyboard International3167 'HENKAN': 0x8a, # Keyboard International4168 'MUHENKAN': 0x8b, # Keyboard International5169 'KPJPCOMMA': 0x8c, # Keyboard International6170 'HANGEUL': 0x90, # Keyboard LANG1171 'HANJA': 0x91, # Keyboard LANG2172 'KATAKANA': 0x92, # Keyboard LANG3173 'HIRAGANA': 0x93, # Keyboard LANG4174 'ZENKAKUHANKAKU': 0x94, # Keyboard LANG5175 'KPLEFTPAREN': 0xb6, # Keypad (176 'KPRIGHTPAREN': 0xb7, # Keypad )177 'CTRL': 0xe0, # Keyboard Left Control # Todo autodetect178 'CONTROL': 0xe0, # Keyboard Left Control179 'LEFTCTRL': 0xe0, # Keyboard Left Control180 'LEFTCONTROL': 0xe0, # Keyboard Left Control181 'SHIFT': 0xe1, # Keyboard Left Shift182 'LEFTSHIFT': 0xe1, # Keyboard Left Shift183 'ALT': 0xe2, # Keyboard Left Alt184 'LEFTALT': 0xe2, # Keyboard Left Alt185 'LEFTMETA': 0xe3, # Keyboard Left GUI186 'WINDOWS': 0xe3, # Keyboard Left GUI187 'GUI': 0xe3, # Keyboard Left GUI # TODO auto detect side188 'LEFTGUI': 0xe3, # Keyboard Left GUI189 'LEFTWINDOWS': 0xe3, # Keyboard Left GUI190 'RIGHTCTRL': 0xe4, # Keyboard Right Control191 'RIGHTCONTROL': 0xe4, # Keyboard Right Control192 'RIGHTSHIFT': 0xe5, # Keyboard Right Shift193 'RIGHTALT': 0xe6, # Keyboard Right Alt194 'RIGHTMETA': 0xe7, # Keyboard Right GUI195 'RIGHTWINDOWS': 0xe7, # Keyboard Right GUI196 'RIGHTGUI': 0xe7, # Keyboard Right GUI197 'MEDIAPLAYPAUSE': 0xe8,198 'MEDIASTOPCD': 0xe9,199 'MEDIAPREVIOUSSONG': 0xea,200 'MEDIANEXTSONG': 0xeb,201 'MEDIAEJECTCD': 0xec,202 'VOLUMEUP': 0xed,203 'MEDIAVOLUMEDOWN': 0xee,204 'MEDIAMUTE': 0xef,205 'MUTE': 0xef,206 'MEDIAWWW': 0xf0,207 'MEDIABACK': 0xf1,208 'BACK': 0xf1,209 'MEDIAFORWARD': 0xf2,210 'FORWARD': 0xf2,211 'MEDIASTOP': 0xf3,212 'MEDIAFIND': 0xf4,213 'MEDIASCROLLUP': 0xf5,214 'MEDIASCROLLDOWN': 0xf6,215 'MEDIAEDIT': 0xf7,216 'MEDIASLEEP': 0xf8,217 'MEDIACOFFEE': 0xf9,218 'MEDIAREFRESH': 0xfa,219 'MEDIACALC': 0xfb...

Full Screen

Full Screen

test_inlinekeyboardmarkup.py

Source:test_inlinekeyboardmarkup.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/].19import pytest20from flaky import flaky21from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyMarkup22@pytest.fixture(scope='class')23def inline_keyboard_markup():24 return InlineKeyboardMarkup(TestInlineKeyboardMarkup.inline_keyboard)25class TestInlineKeyboardMarkup:26 inline_keyboard = [[27 InlineKeyboardButton(text='button1', callback_data='data1'),28 InlineKeyboardButton(text='button2', callback_data='data2')29 ]]30 @flaky(3, 1)31 @pytest.mark.timeout(10)32 def test_send_message_with_inline_keyboard_markup(self, bot, chat_id, inline_keyboard_markup):33 message = bot.send_message(34 chat_id,35 'Testing InlineKeyboardMarkup',36 reply_markup=inline_keyboard_markup)37 assert message.text == 'Testing InlineKeyboardMarkup'38 def test_from_button(self):39 inline_keyboard_markup = InlineKeyboardMarkup.from_button(40 InlineKeyboardButton(text='button1', callback_data='data1')).inline_keyboard41 assert len(inline_keyboard_markup) == 142 assert len(inline_keyboard_markup[0]) == 143 def test_from_row(self):44 inline_keyboard_markup = InlineKeyboardMarkup.from_row([45 InlineKeyboardButton(text='button1', callback_data='data1'),46 InlineKeyboardButton(text='button1', callback_data='data1')]).inline_keyboard47 assert len(inline_keyboard_markup) == 148 assert len(inline_keyboard_markup[0]) == 249 def test_from_column(self):50 inline_keyboard_markup = InlineKeyboardMarkup.from_column([51 InlineKeyboardButton(text='button1', callback_data='data1'),52 InlineKeyboardButton(text='button1', callback_data='data1')]).inline_keyboard53 assert len(inline_keyboard_markup) == 254 assert len(inline_keyboard_markup[0]) == 155 assert len(inline_keyboard_markup[1]) == 156 def test_expected_values(self, inline_keyboard_markup):57 assert inline_keyboard_markup.inline_keyboard == self.inline_keyboard58 def test_expected_values_empty_switch(self, inline_keyboard_markup, bot, monkeypatch):59 def test(url, data, reply_to_message_id=None, disable_notification=None,60 reply_markup=None, timeout=None, **kwargs):61 if reply_markup is not None:62 if isinstance(reply_markup, ReplyMarkup):63 data['reply_markup'] = reply_markup.to_json()64 else:65 data['reply_markup'] = reply_markup66 assert bool('"switch_inline_query": ""' in data['reply_markup'])67 assert bool('"switch_inline_query_current_chat": ""' in data['reply_markup'])68 inline_keyboard_markup.inline_keyboard[0][0].callback_data = None69 inline_keyboard_markup.inline_keyboard[0][0].switch_inline_query = ''70 inline_keyboard_markup.inline_keyboard[0][1].callback_data = None71 inline_keyboard_markup.inline_keyboard[0][1].switch_inline_query_current_chat = ''72 monkeypatch.setattr(bot, '_message', test)73 bot.send_message(123, 'test', reply_markup=inline_keyboard_markup)74 def test_to_dict(self, inline_keyboard_markup):75 inline_keyboard_markup_dict = inline_keyboard_markup.to_dict()76 assert isinstance(inline_keyboard_markup_dict, dict)77 assert inline_keyboard_markup_dict['inline_keyboard'] == [78 [79 self.inline_keyboard[0][0].to_dict(),80 self.inline_keyboard[0][1].to_dict()81 ]82 ]83 def test_de_json(self):84 json_dict = {85 'inline_keyboard': [[86 {87 'text': 'start',88 'url': 'http://google.com'89 },90 {91 'text': 'next',92 'callback_data': 'abcd'93 }],94 [{95 'text': 'Cancel',96 'callback_data': 'Cancel'97 }]98 ]}99 inline_keyboard_markup = InlineKeyboardMarkup.de_json(json_dict, None)100 assert isinstance(inline_keyboard_markup, InlineKeyboardMarkup)101 keyboard = inline_keyboard_markup.inline_keyboard102 assert len(keyboard) == 2103 assert len(keyboard[0]) == 2104 assert len(keyboard[1]) == 1105 assert isinstance(keyboard[0][0], InlineKeyboardButton)106 assert isinstance(keyboard[0][1], InlineKeyboardButton)107 assert isinstance(keyboard[1][0], InlineKeyboardButton)108 assert keyboard[0][0].text == 'start'...

Full Screen

Full Screen

test_replykeyboardmarkup.py

Source:test_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/].19import pytest20from flaky import flaky21from telegram import ReplyKeyboardMarkup, KeyboardButton22@pytest.fixture(scope='class')23def reply_keyboard_markup():24 return ReplyKeyboardMarkup(TestReplyKeyboardMarkup.keyboard,25 resize_keyboard=TestReplyKeyboardMarkup.resize_keyboard,26 one_time_keyboard=TestReplyKeyboardMarkup.one_time_keyboard,27 selective=TestReplyKeyboardMarkup.selective)28class TestReplyKeyboardMarkup:29 keyboard = [[KeyboardButton('button1'), KeyboardButton('button2')]]30 resize_keyboard = True31 one_time_keyboard = True32 selective = True33 @flaky(3, 1)34 @pytest.mark.timeout(10)35 def test_send_message_with_reply_keyboard_markup(self, bot, chat_id, reply_keyboard_markup):36 message = bot.send_message(chat_id, 'Text', reply_markup=reply_keyboard_markup)37 assert message.text == 'Text'38 @flaky(3, 1)39 @pytest.mark.timeout(10)40 def test_send_message_with_data_markup(self, bot, chat_id):41 message = bot.send_message(chat_id, 'text 2', reply_markup={'keyboard': [['1', '2']]})42 assert message.text == 'text 2'43 def test_from_button(self):44 reply_keyboard_markup = ReplyKeyboardMarkup.from_button(45 KeyboardButton(text='button1')).keyboard46 assert len(reply_keyboard_markup) == 147 assert len(reply_keyboard_markup[0]) == 148 reply_keyboard_markup = ReplyKeyboardMarkup.from_button('button1').keyboard49 assert len(reply_keyboard_markup) == 150 assert len(reply_keyboard_markup[0]) == 151 def test_from_row(self):52 reply_keyboard_markup = ReplyKeyboardMarkup.from_row([53 KeyboardButton(text='button1'),54 KeyboardButton(text='button2')]).keyboard55 assert len(reply_keyboard_markup) == 156 assert len(reply_keyboard_markup[0]) == 257 reply_keyboard_markup = ReplyKeyboardMarkup.from_row(['button1', 'button2']).keyboard58 assert len(reply_keyboard_markup) == 159 assert len(reply_keyboard_markup[0]) == 260 def test_from_column(self):61 reply_keyboard_markup = ReplyKeyboardMarkup.from_column([62 KeyboardButton(text='button1'),63 KeyboardButton(text='button2')]).keyboard64 assert len(reply_keyboard_markup) == 265 assert len(reply_keyboard_markup[0]) == 166 assert len(reply_keyboard_markup[1]) == 167 reply_keyboard_markup = ReplyKeyboardMarkup.from_column(['button1', 'button2']).keyboard68 assert len(reply_keyboard_markup) == 269 assert len(reply_keyboard_markup[0]) == 170 assert len(reply_keyboard_markup[1]) == 171 def test_expected_values(self, reply_keyboard_markup):72 assert isinstance(reply_keyboard_markup.keyboard, list)73 assert isinstance(reply_keyboard_markup.keyboard[0][0], KeyboardButton)74 assert isinstance(reply_keyboard_markup.keyboard[0][1], KeyboardButton)75 assert reply_keyboard_markup.resize_keyboard == self.resize_keyboard76 assert reply_keyboard_markup.one_time_keyboard == self.one_time_keyboard77 assert reply_keyboard_markup.selective == self.selective78 def test_to_dict(self, reply_keyboard_markup):79 reply_keyboard_markup_dict = reply_keyboard_markup.to_dict()80 assert isinstance(reply_keyboard_markup_dict, dict)81 assert (reply_keyboard_markup_dict['keyboard'][0][0]82 == reply_keyboard_markup.keyboard[0][0].to_dict())83 assert (reply_keyboard_markup_dict['keyboard'][0][1]84 == reply_keyboard_markup.keyboard[0][1].to_dict())85 assert (reply_keyboard_markup_dict['resize_keyboard']86 == reply_keyboard_markup.resize_keyboard)87 assert (reply_keyboard_markup_dict['one_time_keyboard']88 == reply_keyboard_markup.one_time_keyboard)...

Full Screen

Full Screen

test_inlinekeyboardbutton.py

Source:test_inlinekeyboardbutton.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/].19import pytest20from telegram import InlineKeyboardButton, LoginUrl21@pytest.fixture(scope='class')22def inline_keyboard_button():23 return InlineKeyboardButton(TestInlineKeyboardButton.text,24 url=TestInlineKeyboardButton.url,25 callback_data=TestInlineKeyboardButton.callback_data,26 switch_inline_query=TestInlineKeyboardButton.switch_inline_query,27 switch_inline_query_current_chat=TestInlineKeyboardButton28 .switch_inline_query_current_chat,29 callback_game=TestInlineKeyboardButton.callback_game,30 pay=TestInlineKeyboardButton.pay,31 login_url=TestInlineKeyboardButton.login_url)32class TestInlineKeyboardButton:33 text = 'text'34 url = 'url'35 callback_data = 'callback data'36 switch_inline_query = 'switch_inline_query'37 switch_inline_query_current_chat = 'switch_inline_query_current_chat'38 callback_game = 'callback_game'39 pay = 'pay'40 login_url = LoginUrl("http://google.com")41 def test_expected_values(self, inline_keyboard_button):42 assert inline_keyboard_button.text == self.text43 assert inline_keyboard_button.url == self.url44 assert inline_keyboard_button.callback_data == self.callback_data45 assert inline_keyboard_button.switch_inline_query == self.switch_inline_query46 assert (inline_keyboard_button.switch_inline_query_current_chat47 == self.switch_inline_query_current_chat)48 assert inline_keyboard_button.callback_game == self.callback_game49 assert inline_keyboard_button.pay == self.pay50 assert inline_keyboard_button.login_url == self.login_url51 def test_to_dict(self, inline_keyboard_button):52 inline_keyboard_button_dict = inline_keyboard_button.to_dict()53 assert isinstance(inline_keyboard_button_dict, dict)54 assert inline_keyboard_button_dict['text'] == inline_keyboard_button.text55 assert inline_keyboard_button_dict['url'] == inline_keyboard_button.url56 assert inline_keyboard_button_dict['callback_data'] == inline_keyboard_button.callback_data57 assert (inline_keyboard_button_dict['switch_inline_query']58 == inline_keyboard_button.switch_inline_query)59 assert (inline_keyboard_button_dict['switch_inline_query_current_chat']60 == inline_keyboard_button.switch_inline_query_current_chat)61 assert inline_keyboard_button_dict['callback_game'] == inline_keyboard_button.callback_game62 assert inline_keyboard_button_dict['pay'] == inline_keyboard_button.pay63 assert inline_keyboard_button_dict['login_url'] == \64 inline_keyboard_button.login_url.to_dict() # NOQA: E12765 def test_de_json(self, bot):66 json_dict = {67 'text': self.text,68 'url': self.url,69 'callback_data': self.callback_data,70 'switch_inline_query': self.switch_inline_query,71 'switch_inline_query_current_chat': self.switch_inline_query_current_chat,72 'callback_game': self.callback_game,73 'pay': self.pay74 }75 inline_keyboard_button = InlineKeyboardButton.de_json(json_dict, None)76 assert inline_keyboard_button.text == self.text77 assert inline_keyboard_button.url == self.url78 assert inline_keyboard_button.callback_data == self.callback_data79 assert inline_keyboard_button.switch_inline_query == self.switch_inline_query80 assert (inline_keyboard_button.switch_inline_query_current_chat81 == self.switch_inline_query_current_chat)82 assert inline_keyboard_button.callback_game == self.callback_game...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard } from '@redwoodjs/forms'2 query FIND_POST_BY_ID($id: Int!) {3 post: post(id: $id) {4 }5 }6export const Loading = () => <div>Loading...</div>7export const Empty = () => <div>Post not found</div>8export const Success = ({ post }) => {9 return (10 <Post post={post} />11}12We'd love for you to contribute to our source code and to make Redwood better! Please read our [contributing guide](

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard } from '@redwoodjs/forms'2const TestPage = () => {3 const [test, setTest] = useState('')4 const [test1, setTest1] = useState('')5 const [test2, setTest2] = useState('')6 const [test3, setTest3] = useState('')7 const [test4, setTest4] = useState('')8 const [test5, setTest5] = useState('')9 const [test6, setTest6] = useState('')10 const [test7, setTest7] = useState('')11 const [test8, setTest8] = useState('')12 const [test9, setTest9] = useState('')13 const [test10, setTest10] = useState('')14 const [test11, setTest11] = useState('')15 const [test12, setTest12] = useState('')16 const [test13, setTest13] = useState('')17 const [test14, setTest14] = useState('')18 const [test15, setTest15] = useState('')19 const [test16, setTest16] = useState('')20 const [test17, setTest17] = useState('')21 const [test18, setTest18] = useState('')22 const [test19, setTest19] = useState('')23 const handleTest = (e) => {24 setTest(e.target.value)25 }26 const handleTest1 = (e) => {27 setTest1(e.target.value)28 }29 const handleTest2 = (e) => {30 setTest2(e.target.value)31 }32 const handleTest3 = (e) => {33 setTest3(e.target.value)34 }35 const handleTest4 = (e) => {36 setTest4(e.target.value)37 }38 const handleTest5 = (e) => {39 setTest5(e.target.value)40 }41 const handleTest6 = (e) => {42 setTest6(e.target.value)43 }44 const handleTest7 = (e) => {45 setTest7(e.target.value)46 }47 const handleTest8 = (e) => {48 setTest8(e.target.value)49 }50 const handleTest9 = (e) => {51 setTest9(e.target.value)52 }53 const handleTest10 = (e) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { useAuth } from '@redwoodjs/auth'2import { Keyboard } from '@redwoodjs/forms'3const Login = () => {4 const { logIn } = useAuth()5 const [email, setEmail] = useState('')6 const [password, setPassword] = useState('')7 const onSubmit = (e) => {8 e.preventDefault()9 logIn({ email, password })10 }11 return (12 <form onSubmit={onSubmit}>13 value={email}14 onChange={setEmail}15 value={password}16 onChange={setPassword}17}18import { useAuth } from '@redwoodjs/auth'19import { LogInCell } from '@redwoodjs/auth'20const Login = () => {21 const { logIn } = useAuth()22 return (23 logIn={logIn}24}25import { useAuth } from '@redwoodjs/auth'26import { SignUpCell } from '@redwoodjs/auth'27const Login = () => {28 const { signUp } = useAuth()29 return (30 signUp={signUp}31}32import { useAuth } from '@redwoodjs/auth'33import { LogIn } from '@redwoodjs/auth'34const Login = () => {35 const { logIn } = useAuth()36 return (37 logIn={logIn}38}39import { useAuth } from '@

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard } from '@redwoodjs/forms'2const Test = () => {3 const [test, setTest] = useState('')4 const [test2, setTest2] = useState('')5 const onChange = (event) => {6 setTest(Keyboard(event))7 }8 const onChange2 = (event) => {9 setTest2(Keyboard(event))10 }11 return (12 <input type="text" onChange={onChange} />13 <input type="text" onChange={onChange2} />14 <p>Test: {test}</p>15 <p>Test2: {test2}</p>16}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard } from '@redwoodjs/forms'2const Test = () => {3 const [test, setTest] = useState('')4 const [test2, setTest2] = useState('')5 const [test3, setTest3] = useState('')6 const [test4, setTest4] = useState('')7 const [test5, setTest5] = useState('')8 const [test6, setTest6] = useState('')9 const [test7, setTest7] = useState('')10 const [test8, setTest8] = useState('')11 const [test9, setTest9] = useState('')12 const [test10, setTest10] = useState('')13 const [test11, setTest11] = useState('')14 const [test12, setTest12] = useState('')15 const [test13, setTest13] = useState('')16 const [test14, setTest14] = useState('')17 const [test15, setTest15] = useState('')18 const [test16, setTest16] = useState('')19 const [test17, setTest17] = useState('')20 const [test18, setTest18] = useState('')21 const [test19, setTest19] = useState('')22 const [test20, setTest20] = useState('')23 const [test21, setTest21] = useState('')24 const [test22, setTest22] = useState('')25 const [test23, setTest23] = useState('')26 const [test24, setTest24] = useState('')27 const [test25, setTest25] = useState('')28 const [test26, setTest26] = useState('')29 const [test27, setTest27] = useState('')30 const [test28, setTest28] = useState('')31 const [test29, setTest29] = useState('')32 const [test30, setTest30] = useState('')33 const [test31, setTest31] = useState('')34 const [test32, setTest32] = useState('')35 const [test33, setTest33] = useState('')36 const [test34, setTest34] = useState('')37 const [test35, setTest35] = useState('')

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard, useKeyboard } from '@redwoodjs/web'2const Test = () => {3 const { addListener } = useKeyboard()4 useEffect(() => {5 const listener = addListener('keydown', (event) => {6 if (event.key === 'Escape') {7 console.log('Escape pressed!')8 }9 })10 return () => {11 listener.remove()12 }13 }, [addListener])14 return (15}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Keyboard } from '@redwoodjs/forms'2const Test = () => {3 return (4 onKey={(key) => {5 console.log(key)6 }}7}8import Test from 'src/pages/Test'9const App = () => {10 return (

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var keyboard = redwood.Keyboard;3var key = keyboard.Key;4var keyEvent = keyboard.KeyEvent;5var robot = require('robotjs');6function moveMouse(x,y){7 robot.moveMouse(x,y);8}9function clickMouse(){10 robot.mouseClick();11}12function typeKey(key){13 robot.typeString(key);14}15function pressKey(key){16 robot.keyTap(key);17}18function pressKeyWithModifier(key,modifier){19 robot.keyTap(key,modifier);20}21function pressKeyWithModifiers(key,modifiers){22 robot.keyTap(key,modifiers);23}24function pressKeyWithDelay(key,delay){25 robot.keyTap(key,null,delay);26}27function pressKeyWithModifiersAndDelay(key,modifiers,delay){28 robot.keyTap(key,modifiers,delay);29}30function pressKeyWithModifierAndDelay(key,modifier,delay){31 robot.keyTap(key,modifier,delay);32}33function pressKeyWithDelay(key,delay){34 robot.keyTap(key,null,delay);35}36function pressKeyWithModifiersAndDelay(key,modifiers,delay){37 robot.keyTap(key,modifiers,delay);38}39function pressKeyWithModifierAndDelay(key,modifier,delay){40 robot.keyTap(key,modifier,delay);41}42function pressKeyWithDelay(key,delay){43 robot.keyTap(key,null,delay);44}45function pressKeyWithModifiersAndDelay(key,modifiers,delay){46 robot.keyTap(key,modifiers,delay);47}48function pressKeyWithModifierAndDelay(key,modifier,delay){49 robot.keyTap(key,modifier,delay);50}51function pressKeyWithDelay(key,delay){52 robot.keyTap(key,null,delay);53}54function pressKeyWithModifiersAndDelay(key,modifiers,delay){55 robot.keyTap(key,modifiers,delay);56}57function pressKeyWithModifierAndDelay(key,modifier,delay){58 robot.keyTap(key,modifier,delay);59}60function pressKeyWithDelay(key,delay){61 robot.keyTap(key,null,delay);62}63function pressKeyWithModifiersAndDelay(key,modifiers,delay){64 robot.keyTap(key,modifiers,delay);65}66function pressKeyWithModifierAndDelay(key,modifier,delay){67 robot.keyTap(key,modifier,delay);68}69function pressKeyWithDelay(key,delay){70 robot.keyTap(key,null,delay);71}72function pressKeyWithModifiersAndDelay(key,modifiers,delay){73 robot.keyTap(key,modifiers,delay);

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 redwood 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