danparizher / Pax-Academia

General purpose utility bot for the Homework Help Discord server
MIT License
13 stars 5 forks source link

Bug: Message count error in DMs #174

Closed sebastiaan-daniels closed 1 year ago

sebastiaan-daniels commented 1 year ago

Every time a user sends a direct message to the bot (not a command), the bot raises an error in messagecounter.py

Traceback (most recent call last):
  File "xxx\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "xxx\MessageCounter.py", line 31, in on_message
    category_name = message.channel.category.name.lower()
                    ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DMChannel' object has no attribute 'category'

Fix: exit (return) event (on_message) if message is a direct message