Skip to content

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

Open
Lumabots wants to merge 39 commits intomasterfrom
on_scheduled_event_delete
Open

fix: GuildSchedule not being cached correctly + missing fields#3025
Lumabots wants to merge 39 commits intomasterfrom
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.

@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 <paillat@pycord.dev>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@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
Copy link
Copy Markdown
Member

@Lumabots Your PR uses utils.deprecated. Use @typing_extensions.deprecated instead.

entity_type: ScheduledEventEntityType = MISSING,
entity_metadata: ScheduledEventEntityMetadata | None = MISSING,
channel_id: int = MISSING,
privacy_level: ScheduledEventPrivacyLevel = ScheduledEventPrivacyLevel.guild_only,
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.

privacy_level is deprecated and ignored by the api

discord/guild.py Outdated
entity_type: ScheduledEventEntityType = MISSING,
entity_metadata: ScheduledEventEntityMetadata | None = MISSING,
channel_id: int = MISSING,
privacy_level: ScheduledEventPrivacyLevel = ScheduledEventPrivacyLevel.guild_only,
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.

see above

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.

Here it wasn't added tho so we can't remove it. But you can warn_deprecated @Lumabots when it's not MISSING

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.

deprecate it and avoid emitting it in calls

@Lulalaby Lulalaby added this to Pycord Mar 18, 2026
@github-project-automation github-project-automation bot moved this to Todo in Pycord Mar 18, 2026
@Paillat-dev Paillat-dev requested review from a team March 24, 2026 10:22
@github-actions github-actions bot added the invalid This doesn't seem right label Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This pull request does not follow the required pull request template.

Please use the default template (PULL_REQUEST_TEMPLATE.md) and fill out all required sections.

Problems detected:

The line "AI Usage has been disclosed." is missing.

@github-actions github-actions bot closed this Apr 13, 2026
@github-actions github-actions bot locked as spam and limited conversation to collaborators Apr 13, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in Pycord Apr 13, 2026
@Paillat-dev Paillat-dev reopened this Apr 13, 2026
@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
@typing_extensions.deprecated(
"location is deprecated since 2.7 and will be removed in 3.0, consider using entity_metadata instead",
)
def location(self) -> ScheduledEventLocation | None:
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 property never returns anything. Also this can lead to infinite reucrsion (? I think) since it sets self.location inside itself.

Comment on lines 312 to +313
f"creator_id={self.creator_id}>"
f"channel_id={self.channel_id}>"
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.

Suggested change
f"creator_id={self.creator_id}>"
f"channel_id={self.channel_id}>"
f"creator_id={self.creator_id} "
f"channel_id={self.channel_id}>"

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.

Also this uses deprecated attributes like self.location and self.user_count


async def _fill_from_cache(self):
"""Fill subscribers queue from cached user IDs."""
cached_user_ids = list(self.event._cached_subscribers.keys())
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.

event._cached_subscribers is set[int] which doesn't have keys

"scheduled_start_time": start_time.isoformat(),
"privacy_level": int(privacy_level),
"scheduled_start_time": scheduled_start_time.isoformat(),
"entity_type": int(entity_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 could be missing which would lead here to an error bc of int(MISSING)

def location(self) -> ScheduledEventLocation | None:
"""Returns the location of the event."""
if self.channel_id is None:
self.location = ScheduledEventLocation(
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.

So basically this is deprecated but then it means accessing the deprecated .location will cause two warnings. Maybe add an _internal: True which doesn't warn_deprecated in the init or something.

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: Done

Development

Successfully merging this pull request may close these issues.

on_scheduled_event_delete event parameter is useless

4 participants