Skip to content

Commit 062b9ea

Browse files
committed
h
1 parent fb5d92a commit 062b9ea

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

discord/bot.py

+20-8
Original file line numberDiff line numberDiff line change
@@ -1164,24 +1164,22 @@ def __init__(self, description=None, *args, **options):
11641164
self.auto_sync_commands = options.get("auto_sync_commands", True)
11651165

11661166
self.debug_guilds = options.pop("debug_guilds", None)
1167-
self.default_command_contexts = set(
1168-
options.pop(
1167+
self.default_command_contexts = options.pop(
11691168
"default_command_contexts",
11701169
{
11711170
InteractionContextType.guild,
11721171
InteractionContextType.bot_dm,
11731172
InteractionContextType.private_channel,
11741173
},
11751174
)
1176-
)
1177-
self.default_command_integration_types = set(
1178-
options.pop(
1175+
1176+
self.default_command_integration_types = options.pop(
11791177
"default_command_integration_types",
11801178
{
11811179
IntegrationType.guild_install,
11821180
},
11831181
)
1184-
)
1182+
11851183

11861184
if self.owner_id and self.owner_ids:
11871185
raise TypeError("Both owner_id and owner_ids are set.")
@@ -1192,6 +1190,20 @@ def __init__(self, description=None, *args, **options):
11921190
raise TypeError(
11931191
f"owner_ids must be a collection not {self.owner_ids.__class__!r}"
11941192
)
1193+
if not isinstance(
1194+
self.default_command_contexts, collections.abc.Collection
1195+
):
1196+
raise TypeError(
1197+
f"default_command_contexts must be a collection not {self.default_command_contexts.__class__!r}"
1198+
)
1199+
if not isinstance(
1200+
self.default_command_integration_types, collections.abc.Collection
1201+
):
1202+
raise TypeError(
1203+
f"default_command_integration_types must be a collection not {self.default_command_integration_types.__class__!r}"
1204+
)
1205+
self.default_command_contexts = set(self.default_command_contexts)
1206+
self.default_command_integration_types = set(self.default_command_integration_types)
11951207

11961208
self._checks = []
11971209
self._check_once = []
@@ -1472,13 +1484,13 @@ class Bot(BotBase, Client):
14721484
:attr:`.process_application_commands` if the command is not found. Defaults to ``True``.
14731485
14741486
.. versionadded:: 2.0
1475-
default_command_contexts: Set[:class:`InteractionContextType`]
1487+
default_command_contexts: Collection[:class:`InteractionContextType`]
14761488
The default context types that the bot will use for commands.
14771489
Defaults to a set containing :attr:`InteractionContextType.guild`, :attr:`InteractionContextType.bot_dm`, and
14781490
:attr:`InteractionContextType.private_channel`.
14791491
14801492
.. versionadded:: 2.6
1481-
default_command_integration_types: Set[:class:`IntegrationType`]
1493+
default_command_integration_types: Collection[:class:`IntegrationType`]]
14821494
The default integration types that the bot will use for commands.
14831495
Defaults to a set containing :attr:`IntegrationType.guild_install`.
14841496

0 commit comments

Comments
 (0)