Skip to content

fix: GuildSchedule not being cached correctly + missing fields#3025

Open
Lumabots wants to merge 51 commits into
masterfrom
on_scheduled_event_delete
Open

fix: GuildSchedule not being cached correctly + missing fields#3025
Lumabots wants to merge 51 commits into
masterfrom
on_scheduled_event_delete

Conversation

@Lumabots
Copy link
Copy Markdown
Contributor

@Lumabots Lumabots commented Dec 9, 2025

Summary

summary is not complete, just check the code

Added
New Enums :
ScheduledEventRecurrenceFrequency (yearly, monthly, weekly, daily)
ScheduledEventRecurrenceWeekday (monday-sunday)
ScheduledEventRecurrenceMonth (january-december)

New Classes:
ScheduledEventEntityMetadata (location)
ScheduledEventRecurrenceNWeekday Represents n-weekday entries (e.g., "1st Tuesday")
ScheduledEventRecurrenceRule: Full recurrence rule with validation

Auto-validates on to_payload() serialization
New fields Guild.create_scheduled_event():

  • well at this point just read the code

Enforces Discord's constraints:

  • Frequency-specific field combinations
  • Mutually exclusive field checks
  • Valid weekday set validation for daily events
  • Required field enforcement for yearly events

Information

  • This PR fixes an issue. on_scheduled_event_delete event parameter is useless #1709
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.
  • AI Usage has been disclosed.

@Lumabots Lumabots requested a review from a team as a code owner December 9, 2025 19:51
@pycord-app
Copy link
Copy Markdown

pycord-app Bot commented Dec 9, 2025

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3025/head:pr-3025
git checkout pr-3025

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3025/head

@Lumabots
Copy link
Copy Markdown
Contributor Author

Lumabots commented Dec 9, 2025

Audit Logs still need to be rework (i didnt understand how it work yet)

@Lumabots
Copy link
Copy Markdown
Contributor Author

should we use use_cache_on_error, instead of only use cache ? that way we will be able to fetch first and if unavailable we will get
Open of better variable name

@Paillat-dev Paillat-dev changed the title feat: Full rework of GuildSchedule fux: GuildSchedule not being cached correctly Dec 10, 2025
Copy link
Copy Markdown
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

If possible, make this pr not interfere with the recurrence one from anonymous. There will probably be merge conflicts once that one is merged, but they shouldn't both implement recurrence in a different way.

Comment thread discord/enums.py
Comment thread discord/enums.py Outdated
Comment thread discord/scheduled_events.py
Comment thread discord/scheduled_events.py Outdated
@Paillat-dev Paillat-dev added API reflection Discord API isn't correctly reflected hold: testing This pull request requires further testing priority: medium Medium Priority labels Dec 10, 2025
Co-authored-by: Paillat <[email protected]>
Signed-off-by: Lumouille <[email protected]>
@Lumabots
Copy link
Copy Markdown
Contributor Author

If possible, make this pr not interfere with the recurrence one from anonymous. There will probably be merge conflicts once that one is merged, but they shouldn't both implement recurrence in a different way.

when anonymous pr will be merged i'll edit it to make it work

@Lulalaby Lulalaby changed the title fux: GuildSchedule not being cached correctly fix: GuildSchedule not being cached correctly Dec 12, 2025
@Lulalaby
Copy link
Copy Markdown
Member

fixed ur fux
image

@Paillat-dev Paillat-dev removed the invalid This doesn't seem right label Apr 13, 2026
@Pycord-Development Pycord-Development unlocked this conversation Apr 13, 2026
Comment thread discord/scheduled_events.py
Comment thread discord/scheduled_events.py Outdated
Comment thread discord/iterators.py Outdated
Comment thread discord/guild.py Outdated
Comment thread discord/scheduled_events.py Outdated
@Lulalaby Lulalaby force-pushed the master branch 3 times, most recently from 25347b5 to cc6ebbb Compare April 14, 2026 09:00
@Paillat-dev Paillat-dev force-pushed the master branch 2 times, most recently from 45025bd to 01e9fa8 Compare April 14, 2026 10:21
@Paillat-dev Paillat-dev requested a review from Dorukyum April 17, 2026 17:06
Copy link
Copy Markdown
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

Also please use from typing_extensions import deprecated and not typing_extensions.deprecated throughout

Comment thread discord/scheduled_events.py
Comment thread discord/scheduled_events.py Outdated
return ScheduledEvent(
data=data, guild=self.guild, creator=self.creator, state=self._state
)
data = await self._state.http.edit_scheduled_event(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason why the if payload != {} guard was removed ?

Comment thread discord/scheduled_events.py Outdated
Comment thread discord/scheduled_events.py Outdated
Comment thread discord/enums.py
Comment thread discord/scheduled_events.py Outdated
Comment thread discord/guild.py
Comment thread discord/iterators.py
self.with_member = with_member
self.before = before
self.after = after
self.use_cache = use_cache
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The behavior of use_cache should be documented and maybe a warning be thrown if limit is not None / with_member is false and use_cache is true, since only member objects are returned when using use_cache

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how could you want me to warn ? with a logging.warning ? with a warn.warning ?

Comment thread discord/audit_logs.py
_enum_transformer(enums.NotificationLevel),
),
"entity_metadata": (None, _transform_entity_metadata),
"location": (None, _transform_entity_metadata),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still confused, location isn't supposed to exist as a top level property on Discord's side no ? So why even do we want to set this if it's never there in the first place ? This code is a mess so I may be wrong here but I'm confused as to why we would handle something Discord doesn't send.

Comment thread discord/audit_logs.py
@@ -279,7 +295,7 @@ class AuditLogChanges:
"status": (None, _enum_transformer(enums.ScheduledEventStatus)),
"entity_type": (
"location_type",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This renames it to location_type which makes it go against the entire pr's idea. But at the same time, it would be brekaing to change it without backwards compat.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i dont understand ur statement, but i didnt really change auditlogs as now its working fine, and im scared touching anything would break it as the code is a big mess imo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Pycord-Development/all-contributors Can someone take a look at this audit log stuff as well that is not me ? I'm worried I'm missing something and this is quite a mess

@Paillat-dev Paillat-dev moved this from Done to Todo in Pycord May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API reflection Discord API isn't correctly reflected hold: changelog This pull request is missing a changelog entry hold: testing This pull request requires further testing priority: medium Medium Priority

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

on_scheduled_event_delete event parameter is useless

6 participants