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: Add image parameter to create_scheduled_event #1831

6 changes: 6 additions & 0 deletions discord/guild.py
Expand Up @@ -3650,6 +3650,7 @@ async def create_scheduled_event(
location: str | int | VoiceChannel | StageChannel | ScheduledEventLocation,
privacy_level: ScheduledEventPrivacyLevel = ScheduledEventPrivacyLevel.guild_only,
reason: str | None = None,
cover: bytes = MISSING,
Lulalaby marked this conversation as resolved.
Show resolved Hide resolved
) -> ScheduledEvent | None:
"""|coro|
Creates a scheduled event.
Expand All @@ -3672,6 +3673,8 @@ async def create_scheduled_event(
so there is no need to change this parameter.
reason: Optional[:class:`str`]
The reason to show in the audit log.
cover: Optional[:class:`bytes`]
Lulalaby marked this conversation as resolved.
Show resolved Hide resolved
The cover image of the scheduled event

Returns
-------
Expand Down Expand Up @@ -3709,6 +3712,9 @@ async def create_scheduled_event(
if end_time is not MISSING:
payload["scheduled_end_time"] = end_time.isoformat()

if cover is not MISSING:
Lulalaby marked this conversation as resolved.
Show resolved Hide resolved
payload["image"] = utils._bytes_to_base64_data(cover)
Lulalaby marked this conversation as resolved.
Show resolved Hide resolved

data = await self._state.http.create_scheduled_event(
guild_id=self.id, reason=reason, **payload
)
Expand Down
1 change: 1 addition & 0 deletions discord/http.py
Expand Up @@ -2231,6 +2231,7 @@ def create_scheduled_event(
"description",
"entity_type",
"entity_metadata",
"image",
)
payload = {k: v for k, v in payload.items() if k in valid_keys}

Expand Down