diff --git a/changelog/882.feature.rst b/changelog/882.feature.rst new file mode 100644 index 0000000000..177ab171bf --- /dev/null +++ b/changelog/882.feature.rst @@ -0,0 +1 @@ +Add ``guild_scheduled_event`` parameter to :meth:`StageChannel.create_instance`. diff --git a/disnake/channel.py b/disnake/channel.py index d98a48339b..263735e24e 100644 --- a/disnake/channel.py +++ b/disnake/channel.py @@ -2193,6 +2193,7 @@ async def create_instance( topic: str, privacy_level: StagePrivacyLevel = MISSING, notify_everyone: bool = False, + guild_scheduled_event: Snowflake = MISSING, reason: Optional[str] = None, ) -> StageInstance: """|coro| @@ -2213,8 +2214,6 @@ async def create_instance( The stage instance's topic. privacy_level: :class:`StagePrivacyLevel` The stage instance's privacy level. Defaults to :attr:`StagePrivacyLevel.guild_only`. - reason: Optional[:class:`str`] - The reason the stage instance was created. Shows up on the audit log. notify_everyone: :class:`bool` Whether to notify ``@everyone`` that the stage instance has started. Requires the :attr:`~Permissions.mention_everyone` permission on the stage channel. @@ -2222,6 +2221,15 @@ async def create_instance( .. versionadded:: 2.5 + guild_scheduled_event: :class:`abc.Snowflake` + The guild scheduled event associated with the stage instance. + Setting this will automatically start the event. + + .. versionadded:: 2.10 + + reason: Optional[:class:`str`] + The reason the stage instance was created. Shows up on the audit log. + Raises ------ Forbidden @@ -2253,6 +2261,9 @@ async def create_instance( payload["privacy_level"] = privacy_level.value + if guild_scheduled_event is not MISSING: + payload["guild_scheduled_event_id"] = guild_scheduled_event.id + data = await self._state.http.create_stage_instance(**payload, reason=reason) return StageInstance(guild=self.guild, state=self._state, data=data) diff --git a/disnake/http.py b/disnake/http.py index 558b0b1ff6..f8c4b44694 100644 --- a/disnake/http.py +++ b/disnake/http.py @@ -2005,6 +2005,7 @@ def create_stage_instance( "topic", "privacy_level", "send_start_notification", + "guild_scheduled_event_id", ) payload = {k: v for k, v in payload.items() if k in valid_keys}