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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ These changes are available on the `master` branch, but have not yet been releas
- Added new AutoMod trigger metadata properties `regex_patterns`, `allow_list`, and
`mention_total_limit`; and added the `mention_spam` trigger type.
([#1809](https://github.com/Pycord-Development/pycord/pull/1809))
- Added missing `image` parameter to `Guild.create_scheduled_event()` method.
([#1831](https://github.com/Pycord-Development/pycord/pull/1831))

## [2.3.2] - 2022-12-03

Expand Down
6 changes: 6 additions & 0 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -3647,6 +3647,7 @@ async def create_scheduled_event(
location: str | int | VoiceChannel | StageChannel | ScheduledEventLocation,
privacy_level: ScheduledEventPrivacyLevel = ScheduledEventPrivacyLevel.guild_only,
reason: str | None = None,
image: bytes = MISSING,
) -> ScheduledEvent | None:
"""|coro|
Creates a scheduled event.
Expand All @@ -3669,6 +3670,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.
image: Optional[:class:`bytes`]
The cover image of the scheduled event

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

if image is not MISSING:
payload["image"] = utils._bytes_to_base64_data(image)

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
Original file line number Diff line number Diff line change
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