File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -811,6 +811,13 @@ async def log_closure(
811811
812812async def setup (bot ):
813813 """Sets the modmail extension up"""
814+
815+ # Only runs if modmail is enabled
816+ if not bot .file_config .modmail_config .enable_modmail :
817+ # Raising an exception makes the extension loading mark as failed, this is surprisingly
818+ # the most reliable way to ensure the modmail bot or code doesn't run
819+ raise AttributeError ("Modmail was not loaded because it's disabled" )
820+
814821 config = extensionconfig .ExtensionConfig ()
815822
816823 config .add (
@@ -867,12 +874,6 @@ def __init__(self: Self, bot: bot.TechSupportBot):
867874 # Init is used to make variables global so they can be used on the modmail side
868875 super ().__init__ (bot = bot )
869876
870- # Only runs if modmail is enabled
871- if not bot .file_config .modmail_config .enable_modmail :
872- # Raising an exception makes the extension loading mark as failed, this is surprisingly
873- # the most reliable way to ensure the modmail bot or code doesn't run
874- raise AttributeError ("Modmail was not loaded because it's disabled" )
875-
876877 # Makes the TS client available globally for creating threads and populating them with info
877878 # pylint: disable=W0603
878879 global Ts_client
You can’t perform that action at this time.
0 commit comments