From b991975394266e9ea0c8bd3b103be169acf063e5 Mon Sep 17 00:00:00 2001 From: Snawe Date: Thu, 5 Jan 2023 18:22:33 +0100 Subject: [PATCH] feat: Add image parameter to create_scheduled_event (#1831) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> --- CHANGELOG.md | 2 ++ discord/guild.py | 6 ++++++ discord/http.py | 1 + 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b67ace38bb..a2a7ac6176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/discord/guild.py b/discord/guild.py index 3db74df6e7..fb876be2d6 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -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. @@ -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 ------- @@ -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 ) diff --git a/discord/http.py b/discord/http.py index 79455a0879..15f1356e88 100644 --- a/discord/http.py +++ b/discord/http.py @@ -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}