Skip to content

Censor does not run in channels not of type TextChannel #489

@Nydauron

Description

@Nydauron

Censor middleware does not get run on messages that were sent in channels not of the type TextChannel (e.g. discord.threads.Thread or discord.channel.VoiceChannel). This is due to the following lines filtering out messages from ignored channel types:

# Type checking - Assume messages come from a text channel where the author
# is a member of the server
if not isinstance(message.channel, discord.TextChannel) or not isinstance(
message.author,
discord.Member,
):
return

We should change this to a list of channel types where censoring is not needed. If more types are ever added in future discord.py versions that conflict with the current typing/member interface (LSP starts spitting out type errors when accessing message.channel.*), then we can refactor to fix the type warnings.

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