diff --git a/src/api/Routes/applications.ts b/src/api/Routes/applications.ts index 02a3afc6d..3a91978b9 100644 --- a/src/api/Routes/applications.ts +++ b/src/api/Routes/applications.ts @@ -9,6 +9,7 @@ import type { RESTGetAPIApplicationGuildCommandsQuery, RESTGetAPIApplicationGuildCommandsResult, RESTGetAPIApplicationRoleConnectionMetadataResult, + RESTGetAPIEntitlementResult, RESTGetAPIEntitlementsQuery, RESTGetAPIEntitlementsResult, RESTGetAPIGuildApplicationCommandsPermissionsResult, @@ -112,6 +113,7 @@ export interface ApplicationRoutes { ( id: string, ): { + get(args?: RestArgumentsNoBody): Promise; delete(args?: RestArgumentsNoBody): Promise; consume: { post(args?: RestArgumentsNoBody): Promise; diff --git a/src/api/Routes/stickers.ts b/src/api/Routes/stickers.ts index 0a5feafd7..f2df7eb9b 100644 --- a/src/api/Routes/stickers.ts +++ b/src/api/Routes/stickers.ts @@ -1,4 +1,4 @@ -import type { RESTGetAPIStickerResult, RESTGetStickerPacksResult } from '../../types'; +import type { RESTGetAPIStickerPack, RESTGetAPIStickerResult, RESTGetStickerPacksResult } from '../../types'; import type { RestArgumentsNoBody } from '../api'; export interface StickerRoutes { @@ -7,5 +7,10 @@ export interface StickerRoutes { }; 'sticker-packs': { get(args?: RestArgumentsNoBody): Promise; + ( + id: string, + ): { + get(args?: RestArgumentsNoBody): Promise; + }; }; } diff --git a/src/types/payloads/_interactions/base.ts b/src/types/payloads/_interactions/base.ts index 810cb097c..24c39736c 100644 --- a/src/types/payloads/_interactions/base.ts +++ b/src/types/payloads/_interactions/base.ts @@ -10,7 +10,7 @@ import type { APIThreadChannel, ThreadChannelType, } from '../channel'; -import type { APIGuildMember } from '../guild'; +import type { APIGuildMember, APIPartialInteractionGuild } from '../guild'; import type { APIEntitlement } from '../monetization'; import type { APIRole } from '../permissions'; import type { APIUser } from '../user'; @@ -119,6 +119,10 @@ export interface APIBaseInteraction { * The command data payload */ data?: Data; + /** + * The guild it was sent from + */ + guild?: APIPartialInteractionGuild; /** * The guild it was sent from */ diff --git a/src/types/payloads/application.ts b/src/types/payloads/application.ts index c53f5f720..a6812d62d 100644 --- a/src/types/payloads/application.ts +++ b/src/types/payloads/application.ts @@ -119,12 +119,12 @@ export interface APIApplication { /** * The interactions endpoint URL for the application */ - interactions_endpoint_url?: string; + interactions_endpoint_url?: string | null; /** * The application's role connection verification entry point, * which when configured will render the app as a verification method in the guild role verification configuration */ - role_connections_verification_url?: string; + role_connections_verification_url?: string | null; /** * Up to 5 tags of max 20 characters each describing the content and functionality of the application */ diff --git a/src/types/payloads/auditLog.ts b/src/types/payloads/auditLog.ts index f51f9f7fc..124def098 100644 --- a/src/types/payloads/auditLog.ts +++ b/src/types/payloads/auditLog.ts @@ -23,6 +23,7 @@ import type { } from './guild'; import type { APIGuildScheduledEvent, + APIGuildScheduledEventRecurrenceRule, GuildScheduledEventEntityType, GuildScheduledEventStatus, } from './guildScheduledEvent'; @@ -196,6 +197,10 @@ export enum AuditLogEvent { ApplicationCommandPermissionUpdate = 121, + SoundboardSoundCreate = 130, + SoundboardSoundUpdate, + SoundboardSoundDelete, + AutoModerationRuleCreate = 140, AutoModerationRuleUpdate, AutoModerationRuleDelete, @@ -372,6 +377,8 @@ export type APIAuditLogChange = | APIAuditLogChangeKeyDeny | APIAuditLogChangeKeyDescription | APIAuditLogChangeKeyDiscoverySplashHash + | APIAuditLogChangeKeyEmojiId + | APIAuditLogChangeKeyEmojiName | APIAuditLogChangeKeyEnabled | APIAuditLogChangeKeyEnableEmoticons | APIAuditLogChangeKeyEntityType @@ -404,12 +411,14 @@ export type APIAuditLogChange = | APIAuditLogChangeKeyPermissions | APIAuditLogChangeKeyPosition | APIAuditLogChangeKeyPreferredLocale + | APIAuditLogChangeKeyPremiumProgressBarEnabled | APIAuditLogChangeKeyPrivacyLevel | APIAuditLogChangeKeyPruneDeleteDays | APIAuditLogChangeKeyPublicUpdatesChannelId | APIAuditLogChangeKeyRateLimitPerUser | APIAuditLogChangeKeyRegion | APIAuditLogChangeKeyRulesChannelId + | APIAuditLogChangeKeySoundId | APIAuditLogChangeKeySplashHash | APIAuditLogChangeKeyStatus | APIAuditLogChangeKeySystemChannelFlags @@ -420,10 +429,12 @@ export type APIAuditLogChange = | APIAuditLogChangeKeyTriggerMetadata | APIAuditLogChangeKeyTriggerType | APIAuditLogChangeKeyType + | APIAuditLogChangeKeyUserId | APIAuditLogChangeKeyUserLimit | APIAuditLogChangeKeyUses | APIAuditLogChangeKeyVanityURLCode | APIAuditLogChangeKeyVerificationLevel + | APIAuditLogChangeKeyVolume | APIAuditLogChangeKeyWidgetChannelId | APIAuditLogChangeKeyWidgetEnabled; @@ -533,6 +544,11 @@ export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData */ export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>; +/** + * Returned when a guild's boost progress bar is enabled + */ +export type APIAuditLogChangeKeyPremiumProgressBarEnabled = AuditLogChangeData<'premium_progress_bar_enabled', boolean>; + /** * Returned when new role(s) are added */ @@ -607,6 +623,14 @@ export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_ */ export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>; +/** + * Returned when a guild scheduled event's recurrence_rule is changed + */ +export type APIAuditLogChangeKeyRecurrenceRule = AuditLogChangeData< + 'recurrence_rule', + APIGuildScheduledEventRecurrenceRule +>; + /** * Returned when a permission bitfield is changed */ @@ -866,6 +890,27 @@ export type APIAuditLogChangeKeyDefaultThreadRateLimitPerUser = AuditLogChangeDa number >; +/** + * Returned when a soundboard is create or deleted + */ +export type APIAuditLogChangeKeySoundId = AuditLogChangeData<'sound_id', Snowflake>; +/** + * Returned when a soundboard's volume is changed + */ +export type APIAuditLogChangeKeyVolume = AuditLogChangeData<'volume', number>; +/** + * Returned when a soundboard's custom emoji is changed + */ +export type APIAuditLogChangeKeyEmojiId = AuditLogChangeData<'emoji_id', Snowflake>; +/** + * Returned when a soundboard's unicode emoji is changed + */ +export type APIAuditLogChangeKeyEmojiName = AuditLogChangeData<'emoji_name', string>; +/** + * Returned when a sounboard is created + */ +export type APIAuditLogChangeKeyUserId = AuditLogChangeData<'user_id', Snowflake>; + interface AuditLogChangeData { key: K; /** diff --git a/src/types/payloads/channel.ts b/src/types/payloads/channel.ts index 404c544fd..607da85b8 100644 --- a/src/types/payloads/channel.ts +++ b/src/types/payloads/channel.ts @@ -748,10 +748,6 @@ export interface APIMessageSnapshot { * Subset of the message object fields */ message: APIMessageSnapshotFields; - /** - * Id of the origin message's guild - */ - guild_id?: Snowflake; } export type APIMessageSnapshotFields = Pick< @@ -981,7 +977,7 @@ export interface APIThreadMetadata { /** * Whether the thread is locked; when a thread is locked, only users with `MANAGE_THREADS` can unarchive it */ - locked?: boolean; + locked: boolean; /** * Whether non-moderators can add other non-moderators to the thread; only available on private threads */ diff --git a/src/types/payloads/gateway.ts b/src/types/payloads/gateway.ts index 5c48409e8..b84830aad 100644 --- a/src/types/payloads/gateway.ts +++ b/src/types/payloads/gateway.ts @@ -5,7 +5,7 @@ */ import type { Snowflake } from '../index'; -import type { APIChannel, APIThreadMember } from './channel'; +import type { APIThreadChannel, APIThreadMember } from './channel'; import type { APIEmoji } from './emoji'; import type { APIUser } from './user'; @@ -361,7 +361,7 @@ export interface GatewayThreadListSync { /** * Array of the synced threads */ - threads: APIChannel[]; + threads: APIThreadChannel[]; /** * The member objects for the client user in each joined thread that was synced */ diff --git a/src/types/payloads/guild.ts b/src/types/payloads/guild.ts index d9bc6d0e8..10d175ed6 100644 --- a/src/types/payloads/guild.ts +++ b/src/types/payloads/guild.ts @@ -2,7 +2,7 @@ * Types extracted from https://discord.com/developers/docs/resources/guild */ -import type { GuildMemberFlags, Permissions, Snowflake } from '../index'; +import type { GuildMemberFlags, Locale, LocaleString, Permissions, Snowflake } from '../index'; import type { APIEmoji, APIPartialEmoji } from './emoji'; import type { PresenceUpdateReceiveStatus } from './gateway'; import type { OAuth2Scopes } from './oauth2'; @@ -227,7 +227,7 @@ export interface APIGuild extends APIPartialGuild { * * @default "en-US" */ - preferred_locale: string; + preferred_locale: LocaleString; /** * The id of the channel where admins and moderators of Community guilds receive notices from Discord */ @@ -282,6 +282,19 @@ export interface APIGuild extends APIPartialGuild { safety_alerts_channel_id: Snowflake | null; } +/** + * https://discord.com/developers/docs/resources/guild#guild-object-guild-structure + */ +export interface APIPartialInteractionGuild extends Pick { + /** + * The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US" + * + * @unstable https://github.com/discord/discord-api-docs/issues/6938 + * @default "en-US" + */ + locale: Locale; +} + /** * https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */ diff --git a/src/types/payloads/guildScheduledEvent.ts b/src/types/payloads/guildScheduledEvent.ts index c3b59850d..3c23b3bfc 100644 --- a/src/types/payloads/guildScheduledEvent.ts +++ b/src/types/payloads/guildScheduledEvent.ts @@ -1,7 +1,6 @@ -import type { Snowflake } from '../index'; +import type { Snowflake } from '..'; import type { APIGuildMember } from './guild'; import type { APIUser } from './user'; - interface APIGuildScheduledEventBase { /** * The id of the guild event @@ -67,6 +66,108 @@ interface APIGuildScheduledEventBase * The cover image of the scheduled event */ image?: string | null; + /** + * The definition for how often this event should recur + */ + recurrence_rule: APIGuildScheduledEventRecurrenceRule | null; +} +/** + * https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-structure + */ +export interface APIGuildScheduledEventRecurrenceRule { + /** + * Starting time of the recurrence interval + */ + start: string; + /** + * Ending time of the recurrence interval + */ + end: string | null; + /** + * How often the event occurs + */ + frequency: GuildScheduledEventRecurrenceRuleFrequency; + /** + * The spacing between the events, defined by `frequency`. + * For example, `frequency` of {@apilink GuildScheduledEventRecurrenceRuleFrequency#Weekly} and an `interval` of `2` + * would be "every-other week" + */ + interval: number; + /** + * Set of specific days within a week for the event to recur on + */ + by_weekday: GuildScheduledEventRecurrenceRuleWeekday[] | null; + /** + * List of specific days within a specific week (1-5) to recur on + */ + by_n_weekday: GuildScheduledEventRecurrenceRuleNWeekday[] | null; + /** + * Set of specific months to recur on + */ + by_month: GuildScheduledEventRecurrenceRuleMonth[] | null; + /** + * Set of specific dates within a month to recur on + */ + by_month_day: number[] | null; + /** + * Set of days within a year to recur on (1-364) + */ + by_year_day: number[] | null; + /** + * The total amount of times that the event is allowed to recur before stopping + */ + count: number | null; +} +/** + * https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-frequency + */ +export declare enum GuildScheduledEventRecurrenceRuleFrequency { + Yearly = 0, + Monthly = 1, + Weekly = 2, + Daily = 3, +} +/** + * https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-weekday + */ +export declare enum GuildScheduledEventRecurrenceRuleWeekday { + Monday = 0, + Tuesday = 1, + Wednesday = 2, + Thursday = 3, + Friday = 4, + Saturday = 5, + Sunday = 6, +} +/** + * https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-month + */ +export declare enum GuildScheduledEventRecurrenceRuleMonth { + January = 1, + February = 2, + March = 3, + April = 4, + May = 5, + June = 6, + July = 7, + August = 8, + September = 9, + October = 10, + November = 11, + December = 12, +} +/** + * https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-nweekday-structure + */ +export interface GuildScheduledEventRecurrenceRuleNWeekday { + /** + * The week to reoccur on. + */ + n: 1 | 2 | 3 | 4 | 5; + /** + * The day within the week to reoccur on + */ + day: GuildScheduledEventRecurrenceRuleWeekday; } export interface APIStageInstanceGuildScheduledEvent diff --git a/src/types/payloads/monetization.ts b/src/types/payloads/monetization.ts index a08e43337..ad38104be 100644 --- a/src/types/payloads/monetization.ts +++ b/src/types/payloads/monetization.ts @@ -33,13 +33,13 @@ export interface APIEntitlement { */ deleted: boolean; /** - * Start date at which the entitlement is valid. Not present when using test entitlements. + * Start date at which the entitlement is valid. */ - starts_at?: string; + starts_at: string | null; /** - * Date at which the entitlement is no longer valid. Not present when using test entitlements. + * Date at which the entitlement is no longer valid. */ - ends_at?: string | null; + ends_at: string | null; /** * For consumable items, whether or not the entitlement has been consumed */ @@ -163,6 +163,8 @@ export interface APISubscription { sku_ids: string[]; /** List of entitlements granted for this subscription */ entitlements_ids: string[]; + /** List of SKUs that this user will be subscribed to at renewal */ + renewal_sku_ids: Snowflake[] | null; /** Start of the current subscription period */ current_period_start: string; /** End of the current subscription period */ diff --git a/src/types/payloads/template.ts b/src/types/payloads/template.ts index 32a2314ec..175e08d7a 100644 --- a/src/types/payloads/template.ts +++ b/src/types/payloads/template.ts @@ -3,7 +3,7 @@ */ import type { Snowflake } from '../index'; -import type { RESTPostAPIGuildsJSONBody } from '../rest'; +import type { LocaleString, RESTPostAPIGuildsJSONBody } from '../rest'; import type { APIUser } from './user'; /** @@ -60,6 +60,6 @@ export interface APITemplate { export interface APITemplateSerializedSourceGuild extends Omit { description: string | null; - preferred_locale: string; + preferred_locale: LocaleString; icon_hash: string | null; } diff --git a/src/types/payloads/user.ts b/src/types/payloads/user.ts index 7a6e14553..e2b1d9be2 100644 --- a/src/types/payloads/user.ts +++ b/src/types/payloads/user.ts @@ -273,8 +273,11 @@ export interface APIConnection { } export enum ConnectionService { + AmazonMusic = 'amazon-music', BattleNet = 'battlenet', + Bluesky = 'bluesky', BungieNet = 'bungie', + Crunchyroll = 'crunchyroll', Domain = 'domain', eBay = 'ebay', EpicGames = 'epicgames', @@ -282,6 +285,7 @@ export enum ConnectionService { GitHub = 'github', Instagram = 'instagram', LeagueOfLegends = 'leagueoflegends', + Mastodon = 'mastodon', PayPal = 'paypal', PlayStationNetwork = 'playstation', Reddit = 'reddit', diff --git a/src/types/rest/guildScheduledEvent.ts b/src/types/rest/guildScheduledEvent.ts index 3bf0f513e..d57a810b1 100644 --- a/src/types/rest/guildScheduledEvent.ts +++ b/src/types/rest/guildScheduledEvent.ts @@ -89,19 +89,13 @@ export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent; /** * https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */ -export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial & { +export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial< + Omit +> & { /** * The status of the scheduled event */ status?: GuildScheduledEventStatus | undefined; - /** - * The entity metadata of the scheduled event - */ - entity_metadata?: APIGuildScheduledEventEntityMetadata | null | undefined; - /** - * The description of the guild event - */ - description?: string | null | undefined; }; /** diff --git a/src/types/rest/index.ts b/src/types/rest/index.ts index 853a778c8..86dac206e 100644 --- a/src/types/rest/index.ts +++ b/src/types/rest/index.ts @@ -89,8 +89,8 @@ export enum RESTJSONErrorCodes { UnknownDiscoverableServerCategory = 10_059, UnknownSticker, - - UnknownInteraction = 10_062, + UnknownStickerPack, + UnknownInteraction, UnknownApplicationCommand, UnknownVoiceState = 10_065, diff --git a/src/types/rest/monetization.ts b/src/types/rest/monetization.ts index e6646fead..71b5e21c3 100644 --- a/src/types/rest/monetization.ts +++ b/src/types/rest/monetization.ts @@ -33,9 +33,13 @@ export interface RESTGetAPIEntitlementsQuery { */ guild_id?: Snowflake | undefined; /** - * Whether ended entitlements should be omitted + * Whether ended entitlements should be omitted. Defaults to `false`, ended entitlements are included by default */ exclude_ended?: boolean | undefined; + /** + * Whether deleted entitlements should be omitted. Defaults to `true`, deleted entitlements are not included by default + */ + exclude_deleted?: boolean | undefined; } /** @@ -43,6 +47,11 @@ export interface RESTGetAPIEntitlementsQuery { */ export type RESTGetAPIEntitlementsResult = APIEntitlement[]; +/** + * https://discord.com/developers/docs/resources/entitlement#get-entitlement + */ +export type RESTGetAPIEntitlementResult = APIEntitlement; + /** * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */ diff --git a/src/types/rest/sticker.ts b/src/types/rest/sticker.ts index 70d6660ad..831c86fea 100644 --- a/src/types/rest/sticker.ts +++ b/src/types/rest/sticker.ts @@ -12,6 +12,11 @@ export interface RESTGetStickerPacksResult { sticker_packs: APIStickerPack[]; } +/** + * https://discord.com/developers/docs/resources/sticker#get-sticker-pack + */ +export type RESTGetAPIStickerPack = APIStickerPack; + /** * https://discord.com/developers/docs/resources/sticker#list-sticker-packs * diff --git a/src/types/utils/index.ts b/src/types/utils/index.ts index 323fd5f34..0140778cd 100644 --- a/src/types/utils/index.ts +++ b/src/types/utils/index.ts @@ -135,6 +135,18 @@ export const FormattingPatterns = { * The `timestamp` and `style` group properties are present on the `exec` result of this expression */ StyledTimestamp: /-?\d{1,13}):(?