diff --git a/discord/client.py b/discord/client.py index 8e160755c..8d0a4881d 100644 --- a/discord/client.py +++ b/discord/client.py @@ -124,7 +124,6 @@ if TYPE_CHECKING: from .flags import MemberCacheFlags class _ClientOptions(TypedDict, total=False): - intents: Required[Intents] max_messages: NotRequired[Optional[int]] proxy: NotRequired[Optional[str]] proxy_auth: NotRequired[Optional[aiohttp.BasicAuth]] @@ -295,7 +294,7 @@ class Client: The websocket gateway the client is currently connected to. Could be ``None``. """ - def __init__(self, **options: Unpack[_ClientOptions]) -> None: + def __init__(self, *, intents: Intents, **options: Unpack[_ClientOptions]) -> None: self.loop: asyncio.AbstractEventLoop = _loop # self.ws is set in the connect method self.ws: DiscordWebSocket = None # type: ignore @@ -328,7 +327,7 @@ class Client: } self._enable_debug_events: bool = options.pop('enable_debug_events', False) - self._connection: ConnectionState[Self] = self._get_state(**options) + self._connection: ConnectionState[Self] = self._get_state(intents=intents, **options) self._connection.shard_count = self.shard_count self._closing_task: Optional[asyncio.Task[None]] = None self._ready: asyncio.Event = MISSING diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 858d4f10d..cefe837c0 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -175,9 +175,10 @@ class BotBase(GroupMixin[None]): description: Optional[str] = None, allowed_contexts: app_commands.AppCommandContext = MISSING, allowed_installs: app_commands.AppInstallationType = MISSING, + intents: discord.Intents, **options: Unpack[_BotOptions], ) -> None: - super().__init__(**options) + super().__init__(intents=intents, **options) self.command_prefix: PrefixType[BotT] = command_prefix # type: ignore self.extra_events: Dict[str, List[CoroFunc]] = {} # Self doesn't have the ClientT bound, but since this is a mixin it technically does