Skip to content

Commit

Permalink
feat(StageInstance): add guild_scheduled_event field to create inst…
Browse files Browse the repository at this point in the history
…ance (#882)
  • Loading branch information
Victorsitou authored Sep 29, 2023
1 parent 0469787 commit e38ba27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/882.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``guild_scheduled_event`` parameter to :meth:`StageChannel.create_instance`.
15 changes: 13 additions & 2 deletions disnake/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -2213,15 +2214,22 @@ 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.
Defaults to ``False``.
.. 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
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions disnake/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down

0 comments on commit e38ba27

Please sign in to comment.