From e0780e3730972d777403cb447f3a79a260065b61 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 6 Mar 2017 08:36:04 +0100 Subject: [PATCH] Added more methods --- telegram.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telegram.py b/telegram.py index d68c0c11..d1a54110 100644 --- a/telegram.py +++ b/telegram.py @@ -25,6 +25,9 @@ class Bot: # Update user_data loop.create_task(self.update_bot_data()) + def __str__(self): + return self.user_data.first_name + def __repr__(self): return f"" @@ -202,6 +205,9 @@ class Chat: else: raise UpdateError(f"Unknown message type: {self.type}") + def __str__(self): + return self.title + def __repr__(self): return f"<{self.type} Chat {self.title}>" @@ -337,6 +343,9 @@ class Message: else: return f"" + 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: def __init__(self, msg_type, extra=None):