Skip to content

[FEATURE] Filter for chat types #2126

@Bibo-Joshi

Description

@Bibo-Joshi

We currently have

  • Filters.private for private chats
  • Filters.updates.channel_post for channel posts
  • Filters.group for normal and supergroups

We're missing a standalone supergroup filter. Different ideas listed below. Personally, I'd go for 3.

Proposal 1: Minimal invasive

  • Add Filters.supergroup
  • Document that Filters.group allows both

Proposal 2: Adding flags

  • Add a flag to Filters.group to specify, whether supergroups should be allowed or not

Proposal 3: The full way

  • Add Filters.chat_type that basically acts like Filters.chat/user/via_bot, just with update.effective_message.chat.type. We don't need to have Filters.chat_type updatetable, though IMHO. I really don't see a usecase for that.
  • Add shortcuts for private, channel, (super)group as attributes to Filters.chat_type (similar to the Filters.dice)
  • Make Filters.private, group shortcuts that work with Filters.chat_type and deprecate them (adding TelegramDeprecationWarning and documenting it)

By this, we would have two checks for channel (Filters.chat_type.channel and Filters.update.channel_post(s)), but especially is the latter allows to differentiate between original and edited channel post, I thinks both have their value.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions