1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00

Added more methods

This commit is contained in:
Steffo 2017-03-06 08:36:04 +01:00
parent cc30868574
commit e0780e3730

View file

@ -25,6 +25,9 @@ class Bot:
# Update user_data # Update user_data
loop.create_task(self.update_bot_data()) loop.create_task(self.update_bot_data())
def __str__(self):
return self.user_data.first_name
def __repr__(self): def __repr__(self):
return f"<Bot {self.user_data.first_name}>" return f"<Bot {self.user_data.first_name}>"
@ -202,6 +205,9 @@ class Chat:
else: else:
raise UpdateError(f"Unknown message type: {self.type}") raise UpdateError(f"Unknown message type: {self.type}")
def __str__(self):
return self.title
def __repr__(self): def __repr__(self):
return f"<{self.type} Chat {self.title}>" return f"<{self.type} Chat {self.title}>"
@ -337,6 +343,9 @@ class Message:
else: else:
return f"<Message containing {type(self.content)}>" return f"<Message containing {type(self.content)}>"
def reply(self, bot, text, **params):
"""Reply to this message."""
self.chat.send_message(bot, text, reply_to_message_id=self.msg_id, **params)
class ServiceMessage: class ServiceMessage:
def __init__(self, msg_type, extra=None): def __init__(self, msg_type, extra=None):