Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(StageInstance): add guild_scheduled_event field to create instance #882

Merged
Merged
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.8
shiftinv marked this conversation as resolved.
Show resolved Hide resolved

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