Skip to content

Conversation

@Bibo-Joshi
Copy link
Member

closes #2171

Copy link
Member

@Poolitzer Poolitzer left a comment

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)

@Bibo-Joshi
Copy link
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 …

@Poolitzer
Copy link
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 Bibo-Joshi changed the title CallbackQuery.delete_message() Improve and expand CallbackQuery shortcuts Nov 2, 2020
@Bibo-Joshi Bibo-Joshi requested a review from Poolitzer November 2, 2020 17:21
@Poolitzer
Copy link
Member

okay but you didnt change delete_message to delete, intentional?

@Bibo-Joshi
Copy link
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 …

@Poolitzer
Copy link
Member

LGTM then

@Bibo-Joshi Bibo-Joshi merged commit 9831458 into master Nov 5, 2020
@Bibo-Joshi Bibo-Joshi deleted the fix-2171 branch November 5, 2020 16:11
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2020
@Bibo-Joshi Bibo-Joshi added 🔌 enhancement pr description: enhancement and removed enhancement labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🔌 enhancement pr description: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] CallbackQurey.delete_message

3 participants