Skip to content

Commit

Permalink
Avoid errors on messages from non-TextChannels
Browse files Browse the repository at this point in the history
For example if someone DMs the bot.
  • Loading branch information
PeterJCLaw committed Oct 6, 2023
1 parent 476a9c9 commit 8f2adc2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ async def on_member_remove(member: discord.Member) -> None:

@client.event
async def on_message(message: discord.Message) -> None:
if not isinstance(message.channel, discord.TextChannel):
return

channel: discord.TextChannel = message.channel
if not channel.name.startswith(CHANNEL_PREFIX):
return
Expand Down

0 comments on commit 8f2adc2

Please sign in to comment.