Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions techsupport_bot/commands/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,13 @@ async def log_closure(

async def setup(bot):
"""Sets the modmail extension up"""

# Only runs if modmail is enabled
if not bot.file_config.modmail_config.enable_modmail:
# Raising an exception makes the extension loading mark as failed, this is surprisingly
# the most reliable way to ensure the modmail bot or code doesn't run
raise AttributeError("Modmail was not loaded because it's disabled")

config = extensionconfig.ExtensionConfig()

config.add(
Expand Down Expand Up @@ -867,12 +874,6 @@ def __init__(self: Self, bot: bot.TechSupportBot):
# Init is used to make variables global so they can be used on the modmail side
super().__init__(bot=bot)

# Only runs if modmail is enabled
if not bot.file_config.modmail_config.enable_modmail:
# Raising an exception makes the extension loading mark as failed, this is surprisingly
# the most reliable way to ensure the modmail bot or code doesn't run
raise AttributeError("Modmail was not loaded because it's disabled")

# Makes the TS client available globally for creating threads and populating them with info
# pylint: disable=W0603
global Ts_client
Expand Down