Skip to content

Commit f6b0e0e

Browse files
committed
Initial support for Reply Markups
1 parent 0ffad5d commit f6b0e0e

17 files changed

Lines changed: 459 additions & 4 deletions

compiler/api/compiler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,14 @@ def start():
493493
f.write("\n 0xb0700014: \"pyrogram.client.types.UserProfilePhotos\",")
494494
f.write("\n 0xb0700015: \"pyrogram.client.types.ChatPhoto\",")
495495
f.write("\n 0xb0700016: \"pyrogram.client.types.ChatMember\",")
496-
f.write("\n 0xb0700017: \"pyrogram.client.types.Sticker\"")
496+
f.write("\n 0xb0700017: \"pyrogram.client.types.Sticker\",")
497+
498+
f.write("\n 0xb0700018: \"pyrogram.client.types.reply_markup.ForceReply\",")
499+
f.write("\n 0xb0700019: \"pyrogram.client.types.reply_markup.InlineKeyboardButton\",")
500+
f.write("\n 0xb0700020: \"pyrogram.client.types.reply_markup.InlineKeyboardMarkup\",")
501+
f.write("\n 0xb0700021: \"pyrogram.client.types.reply_markup.KeyboardButton\",")
502+
f.write("\n 0xb0700022: \"pyrogram.client.types.reply_markup.ReplyKeyboardMarkup\",")
503+
f.write("\n 0xb0700023: \"pyrogram.client.types.reply_markup.ReplyKeyboardRemove\"")
497504

498505
f.write("\n}\n")
499506

docs/source/pyrogram/types/index.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ Types
2424
InputMediaPhoto
2525
InputMediaVideo
2626
InputPhoneContact
27-
Sticker
27+
Sticker
28+
reply_markup/ForceReply
29+
reply_markup/InlineKeyboardButton
30+
reply_markup/InlineKeyboardMarkup
31+
reply_markup/KeyboardButton
32+
reply_markup/ReplyKeyboardMarkup
33+
reply_markup/ReplyKeyboardRemove
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ForceReply
2+
==========
3+
4+
.. autoclass:: pyrogram.ForceReply
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
InlineKeyboardButton
2+
====================
3+
4+
.. autoclass:: pyrogram.InlineKeyboardButton
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
InlineKeyboardMarkup
2+
====================
3+
4+
.. autoclass:: pyrogram.InlineKeyboardMarkup
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
KeyboardButton
2+
==============
3+
4+
.. autoclass:: pyrogram.KeyboardButton
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ReplyKeyboardMarkup
2+
===================
3+
4+
.. autoclass:: pyrogram.ReplyKeyboardMarkup
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ReplyKeyboardRemove
2+
===================
3+
4+
.. autoclass:: pyrogram.ReplyKeyboardRemove
5+
:members:

pyrogram/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
__version__ = "0.7.1"
2727

2828
from .api.errors import Error
29-
from .client.types import *
29+
from .client.types import (
30+
Audio, Chat, ChatMember, ChatPhoto, Contact, Document, InputMediaPhoto,
31+
InputMediaVideo, InputPhoneContact, Location, Message, MessageEntity,
32+
PhotoSize, Sticker, Update, User, UserProfilePhotos, Venue, Video,
33+
VideoNote, Voice
34+
)
35+
from .client.types.reply_markup import (
36+
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,
37+
KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove
38+
)
3039
from .client import (
3140
Client, ChatAction, ParseMode, Emoji,
3241
MessageHandler, RawUpdateHandler, Filters

pyrogram/api/core/object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def default(self, o: Object):
7676

7777
if o is not None:
7878
if o.startswith("pyrogram.client"):
79-
r = remove_none(OrderedDict([i for i in content.items()]))
79+
r = remove_none(OrderedDict([("_", o)] + [i for i in content.items()]))
8080
r.pop("client", None)
8181

8282
return r

0 commit comments

Comments
 (0)