@@ -12,51 +12,57 @@ like send_audio(), send_document(), send_location(), etc...
1212.. code-block :: python
1313
1414 from pyrogram import Client
15- from pyrogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
15+ from pyrogram.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup,
16+ InlineKeyboardButton)
1617
1718 # Create a client using your bot token
1819 app = Client(" my_bot" , bot_token = " 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" )
1920
20- with app:
21- app.send_message(
22- " me" , # Edit this
23- " This is a ReplyKeyboardMarkup example" ,
24- reply_markup = ReplyKeyboardMarkup(
25- [
26- [" A" , " B" , " C" , " D" ], # First row
27- [" E" , " F" , " G" ], # Second row
28- [" H" , " I" ], # Third row
29- [" J" ] # Fourth row
30- ],
31- resize_keyboard = True # Make the keyboard smaller
32- )
33- )
34-
35- app.send_message(
36- " me" , # Edit this
37- " This is a InlineKeyboardMarkup example" ,
38- reply_markup = InlineKeyboardMarkup(
39- [
40- [ # First row
41- InlineKeyboardButton( # Generates a callback query when pressed
42- " Button" ,
43- callback_data = " data"
44- ),
45- InlineKeyboardButton( # Opens a web URL
46- " URL" ,
47- url = " https://docs.pyrogram.org"
48- ),
21+
22+ async def main ():
23+ async with app:
24+ await app.send_message(
25+ " me" , # Edit this
26+ " This is a ReplyKeyboardMarkup example" ,
27+ reply_markup = ReplyKeyboardMarkup(
28+ [
29+ [" A" , " B" , " C" , " D" ], # First row
30+ [" E" , " F" , " G" ], # Second row
31+ [" H" , " I" ], # Third row
32+ [" J" ] # Fourth row
4933 ],
50- [ # Second row
51- InlineKeyboardButton( # Opens the inline interface
52- " Choose chat" ,
53- switch_inline_query = " pyrogram"
54- ),
55- InlineKeyboardButton( # Opens the inline interface in the current chat
56- " Inline here" ,
57- switch_inline_query_current_chat = " pyrogram"
58- )
34+ resize_keyboard = True # Make the keyboard smaller
35+ )
36+ )
37+
38+ await app.send_message(
39+ " me" , # Edit this
40+ " This is a InlineKeyboardMarkup example" ,
41+ reply_markup = InlineKeyboardMarkup(
42+ [
43+ [ # First row
44+ InlineKeyboardButton( # Generates a callback query when pressed
45+ " Button" ,
46+ callback_data = " data"
47+ ),
48+ InlineKeyboardButton( # Opens a web URL
49+ " URL" ,
50+ url = " https://docs.pyrogram.org"
51+ ),
52+ ],
53+ [ # Second row
54+ InlineKeyboardButton( # Opens the inline interface
55+ " Choose chat" ,
56+ switch_inline_query = " pyrogram"
57+ ),
58+ InlineKeyboardButton( # Opens the inline interface in the current chat
59+ " Inline here" ,
60+ switch_inline_query_current_chat = " pyrogram"
61+ )
62+ ]
5963 ]
60- ]
64+ )
6165 )
62- )
66+
67+
68+ app.run(main())
0 commit comments