feat: missing types (#310)

This commit is contained in:
MARCROCK22 2024-12-23 12:10:35 -04:00 committed by GitHub
parent 8b1f7596e3
commit c65f8ce5c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 225 additions and 33 deletions

View File

@ -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<never>): Promise<RESTGetAPIEntitlementResult>;
delete(args?: RestArgumentsNoBody): Promise<never>;
consume: {
post(args?: RestArgumentsNoBody): Promise<never>;

View File

@ -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<RESTGetStickerPacksResult>;
(
id: string,
): {
get(args?: RestArgumentsNoBody): Promise<RESTGetAPIStickerPack>;
};
};
}

View File

@ -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<Type extends InteractionType, Data> {
* The command data payload
*/
data?: Data;
/**
* The guild it was sent from
*/
guild?: APIPartialInteractionGuild;
/**
* The guild it was sent from
*/

View File

@ -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
*/

View File

@ -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<K extends string, D> {
key: K;
/**

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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<APIGuild, 'features' | 'id'> {
/**
* 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
*/

View File

@ -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<Type extends GuildScheduledEventEntityType> {
/**
* The id of the guild event
@ -67,6 +66,108 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
* 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

View File

@ -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 */

View File

@ -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<RESTPostAPIGuildsJSONBody, 'icon'> {
description: string | null;
preferred_locale: string;
preferred_locale: LocaleString;
icon_hash: string | null;
}

View File

@ -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',

View File

@ -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<RESTPostAPIGuildScheduledEventJSONBody> & {
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<
Omit<RESTPostAPIGuildScheduledEventJSONBody, 'description' | 'entity_metadata' | 'recurrence_rule'>
> & {
/**
* 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;
};
/**

View File

@ -89,8 +89,8 @@ export enum RESTJSONErrorCodes {
UnknownDiscoverableServerCategory = 10_059,
UnknownSticker,
UnknownInteraction = 10_062,
UnknownStickerPack,
UnknownInteraction,
UnknownApplicationCommand,
UnknownVoiceState = 10_065,

View File

@ -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
*/

View File

@ -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
*

View File

@ -135,6 +135,18 @@ export const FormattingPatterns = {
* The `timestamp` and `style` group properties are present on the `exec` result of this expression
*/
StyledTimestamp: /<t:(?<timestamp>-?\d{1,13}):(?<style>[DFRTdft])>/,
/**
* Regular expression for matching a guild navigation mention
*
* The `type` group property is present on the `exec` result of this expression
*/
GuildNavigation: /<id:(?<type>customize|browse|guide|linked-roles)>/,
/**
* Regular expression for matching a linked role mention
*
* The `id` group property is present on the `exec` result of this expression
*/
LinkedRole: /<id:linked-roles:(?<id>\d{17,20})>/,
} as const;
/**