Skip to content

[BUG] Change condition in Filters.user to avoid error with empty lists #1562

@xates

Description

@xates

Consider changing this condition

if not (bool(user_id) ^ bool(username)):

to something like

if (user_id is None) == (username is None):

To avoid throwing the ValueError "One and only one of user_id or username must be used" when an empty list of user_ids or usernames is issued.

Similarly for Filters.chat.

PS This should also be 3 to 4 times faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions