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

types: fix recurrence rule types #10693

Merged
merged 3 commits into from
Jan 12, 2025
Merged

Conversation

vladfrangu
Copy link
Member

Please describe the changes this PR makes and why it should be merged:

Fixes types for recurrence rule being wrong, thanks to a report from @favna

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Copy link

vercel bot commented Jan 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 8:19pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jan 12, 2025 8:19pm

Copy link
Contributor

@favna favna left a comment

Choose a reason for hiding this comment

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

Tested with the following code:

await guild.scheduledEvents.create({
  name: eventData.name,
  entityType: GuildScheduledEventEntityType.External,
  entityMetadata: { location: "FC House" },
  privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly,
  scheduledStartTime: eventData.instance.dateTime,
  scheduledEndTime: addHours(eventData.instance.dateTime, eventData.duration),
  description: eventData.description ?? undefined,
  reason: `Event created by ${leaderUser.user.username}`,

  ...(eventData.interval &&
  (eventData.interval === $Enums.EventInterval.WEEKLY ||
    eventData.interval === $Enums.EventInterval.ONCE_EVERY_OTHER_WEEK)
    ? {
        recurrenceRule: {
          startAt: eventData.instance.dateTime.toISOString(),
          frequency: GuildScheduledEventRecurrenceRuleFrequency.Weekly,
          interval: eventData.interval === $Enums.EventInterval.WEEKLY ? 1 : 2,
          byWeekday: [getISODay(eventData.instance.dateTime) - 1],
          endAt: addHours(eventData.instance.dateTime, eventData.duration),
        },
      }
    : {}),
});

ishare-1736117222-discord
ishare-1736117233-discord

@kodiakhq kodiakhq bot merged commit 24f3954 into main Jan 12, 2025
25 checks passed
@kodiakhq kodiakhq bot deleted the types/create-event-recurring-rule-types branch January 12, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants