- Notifications
You must be signed in to change notification settings - Fork 27
Delete messages #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete messages #84
Conversation
c7cf540 to a56b456 Compare | return self._api.call("sendContact", args, expect=_objects().Message) | ||
| | ||
| @_require_api | ||
| def delete_message(self, message): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to add the docstring.
botogram/objects/mixins.py Outdated
| message = message.message_id | ||
| | ||
| return self._api.call("deleteMessage", { | ||
| "chat_id": self.id, "message_id": message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put all of these on their own line, with a traling comma in all of them?
{ "chat_id": self.id, "message_id": message, } botogram/objects/mixins.py Outdated
| def delete(self): | ||
| """Delete the message""" | ||
| return self._api.call("deleteMessage", {"chat_id": self.chat.id, | ||
| "message_id": self.message_id}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same style for the parameters as the other method.
| Delete the selected message. | ||
| A message can be deleted only if is sent by the bot or sent in a supergroup by an user where the bot is admin. | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to add the versionadded (0.4) and the documentation for the parameter.
| Delete the message self. | ||
| A message can be deleted only if is sent by the bot or sent in a supergroup by an user where the bot is admin. | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to add the versionadded (0.4)
| @pietroalbini Done, it's all ok, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
663ce2e to c5c1262 Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| @pietroalbini Maybe we're ready to merge? |
| Can you add in the docs that in supergroups it's possibile to delete some service messages? |
c5c1262 to a6f4efe Compare docs/api/telegram.rst Outdated
| | ||
| .. py:method:: delete() | ||
| Delete the message self. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? "Delete this message. The message can be deleted only if... It can also be deleted if it's one of the supported service messages."
docs/api/telegram.rst Outdated
| | ||
| .. py:method:: delete_message(message) | ||
| Delete the selected message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Delete the message with the provided ID"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...or botogram.Message object
a6f4efe to 2ce9f50 Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In upcoming Telegram bots API upgrade, bots will able to delete messages sent by itself and sent by users in a supergroup where the bot is admin.
I've added two new methods,
message.delete()andchat.delete_message().Example usage: