Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When inline message id is set and a user is calling delete(), the not really helping error AttributeError: 'NoneType' object has no attribute 'chat_id' is presented. Why not raise a custom one? At least put that in the docs.
And also, why delete_message()? With the message class, we just call it delete. I prefer that its way shorter (what a shortcut is all about imo)
Member Author
And also, why delete_message()? With the message class, we just call it delete. I prefer that its way shorter (what a shortcut is all about imo)
I guess you're right. Just copied from the other shortcuts. Actually, if we're at it, we can replace self.bot.edit_* calls with self.message.edit_*.
If we document CQ.delete_message() as shortcut for callback_query.message.delete(), would you be fine with leaving the error as is? we don't raise custom errors anywhere else …
Member
"anywhere else" can something like this happen, outside of this class? I would be fine not doing it, but I think overall custom errors would be an improvement.
Bibo-Joshi
changed the title
CallbackQuery.delete_message()
Improve and expand CallbackQuery shortcuts
Member Author
okay but you didnt change delete_message to delete, intentional?
uh, yes. I didn't understand your comment as "rename CQ.delete_message to CQ.delete", but as "why are you using bot.delete_message instead of message.delete xD
but anyway I wouldn't wanna reanem to CQ.delete. Comparing with CQ.answer that would impley deleting the CQ … also we named all the other shortcuts CQ.edit_message_* and not CQ.edit_*. with a decent IDE, the shortcutiness is provided by autocomplete anyway …