diff --git a/bot/src/modules/achievements/events/achievement_on_message_event.py b/bot/src/modules/achievements/events/achievement_on_message_event.py index fa108de3..001d71f2 100644 --- a/bot/src/modules/achievements/events/achievement_on_message_event.py +++ b/bot/src/modules/achievements/events/achievement_on_message_event.py @@ -50,7 +50,9 @@ class AchievementOnMessageEvent(OnMessageABC): return server = self._servers.get_server_by_discord_id(message.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(message.author.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id(message.author.id, server.id) + if user is None: + return user.message_count += 1 self._users.update_user(user) diff --git a/bot/src/modules/base/events/base_on_message_event.py b/bot/src/modules/base/events/base_on_message_event.py index beb9c4a6..fa2fc0ee 100644 --- a/bot/src/modules/base/events/base_on_message_event.py +++ b/bot/src/modules/base/events/base_on_message_event.py @@ -86,6 +86,11 @@ class BaseOnMessageEvent(OnMessageABC): if message is None or message.guild is None: return + server = self._servers.get_server_by_discord_id(message.guild.id) + user = self._users.find_user_by_discord_id_and_server_id(message.author.id, server.id) + if user is None: + return + self._logger.info(__name__, f"Received message: {LogMessageHelper.get_log_string(message)}") self._append_received_message_count(message.guild.id)