-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
base: master
Are you sure you want to change the base?
Conversation
Bump (not sure if it is correct to, my bad if so) |
There was a problem hiding this 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.
discord/scheduled_event.py
Outdated
|
||
def __eq__(self, other: object) -> bool: | ||
if isinstance(other, self.__class__): | ||
return self.exception_ids == other.exception_ids |
There was a problem hiding this comment.
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
?
discord/scheduled_event.py
Outdated
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. |
There was a problem hiding this comment.
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.
discord/scheduled_event.py
Outdated
) | ||
return NotImplemented | ||
|
||
def __set_interval(self, value: int) -> None: |
There was a problem hiding this comment.
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?
…current_events
…current_events Merge master to recurrent_events
…current_events
…current_events
PR is ready for review, I have tested it and so far it works as expected. |
There was a problem hiding this 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`]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weekdays: Optional[List[:class:`ScheduledEventRecurrenceWeekday`]] | |
weekdays: List[:class:`ScheduledEventRecurrenceWeekday`] |
Optional[List[X]]
is silly.
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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Summary
Adds support for Scheduled Events Recurrence.
DDevs Docs PR: discord/discord-api-docs#7058
Checklist