Description
tg.Bot
didn't get rich comparison in #1724, though there are use cases when comparison of Bot
with User
objects would be helpful. Most notable when checking if the bot is one of the new chat members reportet in a status update; with rich comparison that would be as easy as
context.bot in update.effective_message.new_chat_members
Currently one can use bot_instance.bot
, which holds the User
instance for comparison, but it's undocumented and unintuitive. Proposal:
- Make
Bot.__eq__(self, other)
basically returnself.bot == other
and document the behaviour accordingly - we need to make sure that
self.bot
is already set. For theBot.{id, username, …}
properties, that's currently done with the@info
decorator. I think it would be cleaner to just convertself.bot
into a property that callsself.get_me()
if needed.