aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/__init__.py14
-rw-r--r--bot/__main__.py3
-rw-r--r--bot/cogs/antispam.py3
-rw-r--r--bot/cogs/modlog.py9
4 files changed, 13 insertions, 16 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index 5a446d71c..54550842e 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -88,12 +88,8 @@ for key, value in logging.Logger.manager.loggerDict.items():
value.addHandler(handler)
-# Silence aio_pika.pika.{callback,channel}, discord, PIL, and and websockets
-logging.getLogger("aio_pika.pika.callback").setLevel(logging.ERROR)
-logging.getLogger("aio_pika.pika.channel").setLevel(logging.ERROR)
-logging.getLogger("discord.client").setLevel(logging.ERROR)
-logging.getLogger("discord.gateway").setLevel(logging.ERROR)
-logging.getLogger("discord.state").setLevel(logging.ERROR)
-logging.getLogger("discord.http").setLevel(logging.ERROR)
-logging.getLogger("PIL.PngImagePlugin").setLevel(logging.ERROR)
-logging.getLogger("websockets.protocol").setLevel(logging.ERROR)
+# Silence irrelevant loggers
+logging.getLogger("aio_pika").setLevel(logging.ERROR)
+logging.getLogger("discord").setLevel(logging.ERROR)
+logging.getLogger("PIL").setLevel(logging.ERROR)
+logging.getLogger("websockets").setLevel(logging.ERROR)
diff --git a/bot/__main__.py b/bot/__main__.py
index 30d1b4c9a..e4dbbfcde 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -50,15 +50,14 @@ bot.load_extension("bot.cogs.bot")
bot.load_extension("bot.cogs.clean")
bot.load_extension("bot.cogs.cogs")
-
# Only load this in production
if not DEBUG_MODE:
+ bot.load_extension("bot.cogs.doc")
bot.load_extension("bot.cogs.verification")
# Feature cogs
bot.load_extension("bot.cogs.deployment")
bot.load_extension("bot.cogs.defcon")
-bot.load_extension("bot.cogs.doc")
bot.load_extension("bot.cogs.eval")
bot.load_extension("bot.cogs.fun")
bot.load_extension("bot.cogs.hiphopify")
diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py
index 7a33ba9e8..d5b72718c 100644
--- a/bot/cogs/antispam.py
+++ b/bot/cogs/antispam.py
@@ -56,7 +56,8 @@ class AntiSpam:
async def on_message(self, message: Message):
if (
- message.guild.id != GuildConfig.id
+ not message.guild
+ or message.guild.id != GuildConfig.id
or message.author.bot
or (message.channel.id in WHITELISTED_CHANNELS and not DEBUG_MODE)
or (message.author.top_role.id in WHITELISTED_ROLES and not DEBUG_MODE)
diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py
index 7240186f1..9c81661ba 100644
--- a/bot/cogs/modlog.py
+++ b/bot/cogs/modlog.py
@@ -440,7 +440,7 @@ class ModLog:
if key in done or key in MEMBER_CHANGES_SUPPRESSED:
continue
- if key == "roles":
+ if key == "_roles":
new_roles = after.roles
old_roles = before.roles
@@ -453,10 +453,11 @@ class ModLog:
changes.append(f"**Role added:** {role.name} (`{role.id}`)")
else:
- new = value["new_value"]
- old = value["old_value"]
+ new = value.get("new_value")
+ old = value.get("old_value")
- changes.append(f"**{key.title()}:** `{old}` **->** `{new}`")
+ if new and old:
+ changes.append(f"**{key.title()}:** `{old}` **->** `{new}`")
done.append(key)