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: Guild Scheduled Event Recurrence #9685

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

DA-344
Copy link
Contributor

@DA-344 DA-344 commented Dec 14, 2023

Summary

Adds support for Scheduled Events Recurrence.

DDevs Docs PR: discord/discord-api-docs#7058

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • 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, ...)

@Vioshim
Copy link
Contributor

Vioshim commented Jun 7, 2024

Bump (not sure if it is correct to, my bad if so)

Copy link
Contributor

@AbstractUmbra AbstractUmbra left a comment

Choose a reason for hiding this comment

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

Respecting that this PR is still in draft I wanted to raise a few things before we get too deep into it.


def __eq__(self, other: object) -> bool:
if isinstance(other, self.__class__):
return self.exception_ids == other.exception_ids
Copy link
Contributor

Choose a reason for hiding this comment

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

This is currently an AttributeError?

Comment on lines 121 to 123
For example, if you want for this event to repeat the 1st Monday of the month,
then this param should have a value of `(1, 0)`. Where ``1`` represents the
'first' and ``0`` the weekday, in this case, Monday.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of an example easily missed here, why not do something like this with a few (small) examples.

)
return NotImplemented

def __set_interval(self, value: int) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

It's uncommon for discord.py to use name mangling on private methods like this. Any particular reason we added it here?

@DA-344 DA-344 changed the title Guild Scheduled Event Recurrence & Exceptions feat: Guild Scheduled Event Recurrence Aug 6, 2024
@DA-344 DA-344 marked this pull request as ready for review August 29, 2024 12:00
@DA-344
Copy link
Contributor Author

DA-344 commented Aug 29, 2024

PR is ready for review, I have tested it and so far it works as expected.
I'll keep testing and fixing errors.
If anyone also tests this and finds any errors please let me know.

Copy link
Owner

@Rapptz Rapptz left a comment

Choose a reason for hiding this comment

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

Try to not use Optional[List[X]], it's bad API design.


This must be ``1``, except when ``frequency`` is :attr:`ScheduledEventRecurrenceFrequency.weekly`,
in which case it can be set to ``2``.
weekdays: Optional[List[:class:`ScheduledEventRecurrenceWeekday`]]
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
weekdays: Optional[List[:class:`ScheduledEventRecurrenceWeekday`]]
weekdays: List[:class:`ScheduledEventRecurrenceWeekday`]

Optional[List[X]] is silly.

Comment on lines +116 to +119
n_weekdays: Optional[List[Tuple[:class:`int`, :class:`ScheduledEventRecurrenceWeekday`]]]
A (week, weekday) tuple list of the N weekdays the event will recur on.
month_days: Optional[List[:class:`datetime.date`]]
The months and month days the scheduled event will recur on.
Copy link
Owner

Choose a reason for hiding this comment

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

This API seems confusing to me. Also Optional[List[X]] is silly.

)
# fmt: on


class ScheduledEventRecurrenceRule:
Copy link
Owner

Choose a reason for hiding this comment

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

I feel like the API for this is better off being revised to work similar to dateutils.rrule module, or at least similar enough to work like it. Right now this doesn't feel good at a glance, though this is just an initial read on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I tried to make it as similar to it as possible, I will rework it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants