Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c95dfe5
feat: Add support for scheduled event recurrence
DA-344 Mar 23, 2025
1d824da
merge branch 'master' from https://github.com/Pycord-Development/pycord
DA-344 Mar 23, 2025
e87b93d
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 23, 2025
476d106
oops
DA-344 Mar 23, 2025
14ebe20
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 23, 2025
2fed715
update scheduled_events.py
DA-344 Apr 1, 2025
2e6cfa9
chore: do some things i dont remember
DA-344 Apr 4, 2025
548304a
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2025
dca1557
chore: Replace 24 to 4
DA-344 Apr 9, 2025
a66bbd8
Merge branch 'feat/recurrence-rule' of https://github.com/da-344/pyco…
DA-344 Apr 9, 2025
0389bc1
chore: Add changelog
DA-344 Apr 9, 2025
84421c5
Merge branch 'master' into feat/recurrence-rule
Lulalaby Sep 1, 2025
032d7c5
Merge branch 'master' into feat/recurrence-rule
Lumabots Oct 20, 2025
f556991
Merge branch 'master' into feat/recurrence-rule
Lulalaby Oct 22, 2025
73ad285
Merge branch 'master' into feat/recurrence-rule
Paillat-dev Oct 22, 2025
3ca31c7
Update or check
DA-344 Dec 11, 2025
0aff636
add overloads
DA-344 Dec 17, 2025
87ba631
Merge branch 'feat/recurrence-rule' of https://github.com/da-344/pyco…
DA-344 Dec 17, 2025
6822c67
Update CHANGELOG.md
DA-344 Jan 19, 2026
8414de0
Update docs/api/enums.rst
DA-344 Jan 19, 2026
990319a
update enum docs
DA-344 Jan 19, 2026
e544abd
merge upstream
DA-344 Jan 19, 2026
7e29ec6
merge master
DA-344 Jan 19, 2026
dce1229
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 19, 2026
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ These changes are available on the `master` branch, but have not yet been releas

### Added

- Added support getting and setting recurrence rules on `ScheduledEvent`s.
([#2749](https://github.com/Pycord-Development/pycord/pull/2749))

### Changed

### Fixed
Expand Down
23 changes: 23 additions & 0 deletions discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
"ThreadArchiveDuration",
"SubscriptionStatus",
"SeparatorSpacingSize",
"ScheduledEventRecurrenceFrequency",
"ScheduledEventWeekday",
"SelectDefaultValueType",
)

Expand Down Expand Up @@ -1104,6 +1106,27 @@ class SubscriptionStatus(Enum):
inactive = 2


class ScheduledEventRecurrenceFrequency(Enum):
"""A scheduled event recurrence rule's frequency."""

yearly = 0
monthly = 1
weekly = 2
daily = 3


class ScheduledEventWeekday(Enum):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weekday implies the days of the typical working week Monday through Friday. Maybe we can use DayOfWeek?

"""A scheduled event week day."""

monday = 0
tuesday = 1
wednesday = 2
thursday = 3
friday = 4
saturday = 5
sunday = 6


class ThreadArchiveDuration(IntEnum):
"""The time set until a thread is automatically archived."""

Expand Down
24 changes: 20 additions & 4 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
from .onboarding import Onboarding
from .permissions import PermissionOverwrite
from .role import Role, RoleColours
from .scheduled_events import ScheduledEvent, ScheduledEventLocation
from .scheduled_events import (
ScheduledEvent,
ScheduledEventLocation,
ScheduledEventRecurrenceRule,
)
from .soundboard import SoundboardSound
from .stage_instance import StageInstance
from .sticker import GuildSticker
Expand Down Expand Up @@ -4219,8 +4223,10 @@ async def create_scheduled_event(
privacy_level: ScheduledEventPrivacyLevel = ScheduledEventPrivacyLevel.guild_only,
reason: str | None = None,
image: bytes = MISSING,
) -> ScheduledEvent | None:
recurrence_rule: ScheduledEventRecurrenceRule | None = MISSING,
) -> ScheduledEvent:
"""|coro|

Creates a scheduled event.

Parameters
Expand All @@ -4242,7 +4248,10 @@ async def create_scheduled_event(
reason: Optional[:class:`str`]
The reason to show in the audit log.
image: Optional[:class:`bytes`]
The cover image of the scheduled event
The cover image of the scheduled event.
recurrence_rule: Optional[:class:`ScheduledEventRecurrenceRule`]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is provided, is start_date ignored ?

The recurrence rule this event will follow. If this is ``None`` then this is a
one-time event.

Returns
-------
Expand All @@ -4256,7 +4265,8 @@ async def create_scheduled_event(
HTTPException
The operation failed.
"""
payload: dict[str, str | int] = {

payload: dict[str, Any] = {
"name": name,
"scheduled_start_time": start_time.isoformat(),
"privacy_level": int(privacy_level),
Expand All @@ -4283,6 +4293,12 @@ async def create_scheduled_event(
if image is not MISSING:
payload["image"] = utils._bytes_to_base64_data(image)

if recurrence_rule is not MISSING:
if recurrence_rule is None:
payload["recurrence_rule"] = None
else:
payload["recurrence_rule"] = recurrence_rule._to_dict()

data = await self._state.http.create_scheduled_event(
guild_id=self.id, reason=reason, **payload
)
Expand Down
Loading