Skip to content

Commit 69aa1c2

Browse files
author
mattijn
committed
added an easier way to get frequent commands from message.
1 parent 5b8f41b commit 69aa1c2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

telegram/message.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ def de_json(data):
171171

172172
return Message(**data)
173173

174+
def __getitem__(self, item):
175+
if item in self.__dict__.keys():
176+
return self.__dict__[item]
177+
elif item == 'chat_id':
178+
return self.chat.id
179+
174180
def to_dict(self):
175181
"""
176182
Returns:

0 commit comments

Comments
 (0)