Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Nydauron opened this issue Jul 14, 2024 · 0 comments
Open

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

Nydauron opened this issue Jul 14, 2024 · 0 comments

Comments

@Nydauron
Copy link
Contributor

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.

@Nydauron Nydauron changed the title Censor does not work in channels not of type TextChannel Censor does not run in channels not of type TextChannel Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant