Skip to content

Commit 2edb6d9

Browse files
committed
[Core]: Fix for force enabled commands.
1 parent 99d7b0e commit 2edb6d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

redbot/core/core_commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,11 +2105,15 @@ async def slash_enablecog(self, ctx: commands.Context, *cog_names: str):
21052105
successful_cogs = set()
21062106
# Fetch a list of command names to enable
21072107
for name, com in self.bot.tree._disabled_global_commands.items():
2108+
if com.extras.get("red_force_enable", False):
2109+
continue
21082110
for cog_name in cog_names:
21092111
if self._is_submodule(cog_name, com.module):
21102112
to_add_slash.append(name)
21112113
successful_cogs.add(cog_name)
21122114
for key, com in self.bot.tree._disabled_context_menus.items():
2115+
if com.extras.get("red_force_enable", False):
2116+
continue
21132117
for cog_name in cog_names:
21142118
if self._is_submodule(cog_name, com.module):
21152119
name, guild_id, com_type = key
@@ -2216,12 +2220,16 @@ async def slash_disablecog(self, ctx: commands.Context, *cog_names: str):
22162220
removed = []
22172221
removed_cogs = set()
22182222
for name, com in self.bot.tree._global_commands.items():
2223+
if com.extras.get("red_force_enable", False):
2224+
continue
22192225
for cog_name in cog_names:
22202226
if self._is_submodule(cog_name, com.module):
22212227
await self.bot.disable_app_command(name, discord.AppCommandType.chat_input)
22222228
removed.append(name)
22232229
removed_cogs.add(cog_name)
22242230
for key, com in self.bot.tree._context_menus.items():
2231+
if com.extras.get("red_force_enable", False):
2232+
continue
22252233
for cog_name in cog_names:
22262234
if self._is_submodule(cog_name, com.module):
22272235
name, guild_id, com_type = key

0 commit comments

Comments
 (0)