Add respond and reply methods to the NewMessage event

This commit is contained in:
Lonami Exo 2018-02-07 13:55:41 +01:00
parent dc43757cff
commit 2e0a8d6bce

View File

@ -190,9 +190,21 @@ class NewMessage(_EventBuilder):
self.is_reply = bool(message.reply_to_msg_id) self.is_reply = bool(message.reply_to_msg_id)
self._reply_message = None self._reply_message = None
def reply(self, message, as_reply=True): def respond(self, *args, **kwargs):
"""Replies to this message""" """
self._client.send_message(self.message.to_id, message) Responds to the message (not as a reply). This is a shorthand for
``client.send_message(event.chat, ...)``.
"""
return self._client.send_message(self.input_chat, *args, **kwargs)
def reply(self, *args, **kwargs):
"""
Replies to the message (as a reply). This is a shorthand for
``client.send_message(event.chat, ..., reply_to=event.message.id)``.
"""
return self._client.send_message(self.input_chat,
reply_to=self.message.id,
*args, **kwargs)
def _get_input_entity(self, msg_id, entity_id, chat=None): def _get_input_entity(self, msg_id, entity_id, chat=None):
""" """