Compare commits

...

16 Commits

Author SHA1 Message Date
Vlad Frangu
cd580fa2c6 chore(release): 0.26.0 🎉 (#276) 2021-12-24 17:31:30 +02:00
Vlad Frangu
c20e5ae2a9 chore: bring in support for TS 4.5's exactOptionalPropertyTypes (#275)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-12-24 17:08:58 +02:00
Vlad Frangu
7fe78cec25 chore: cleanup chat input options (#274) 2021-12-24 15:37:08 +02:00
Jiralite
bfc5e46f53 feat: Add API error code 50109 (#268)
* feat: add API error

* refactor: elongate error name
2021-12-23 10:44:42 +02:00
Suneet Tipirneni
8bbb81942b types: make application command option union easier to use (#250) 2021-12-22 20:19:45 +02:00
Bryce Roethel
46db72da2f fix(GatewayStageInstance): Stage Instance dispatches not included in GatewayDispatchPayload (#267) 2021-12-21 14:37:35 +02:00
Suneet Tipirneni
0bbc9721f6 feat(APIGuildMember): add guild timeouts (#235) 2021-12-21 14:32:54 +02:00
Jiralite
7eee39d86c fix(StickerPack): Optional banner_asset_id (#270)
BREAKING CHANGE: `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
2021-12-16 20:20:20 +02:00
Suneet Tipirneni
2c72242a03 feat(GatewayThreadMemberUpdateDispatchData): add guild_id extra field (#266) 2021-12-14 21:26:46 +02:00
Cynthia
7ab780b3ae fix: only a partial object is needed when updating attachments (#263) 2021-12-13 11:08:39 +02:00
Marvin Witt
315ce35849 fix(NonDispatchPayload): t & s fields are always null on non-dispatch payloads (#259) 2021-12-08 15:16:31 +02:00
Advaith
c67d426e3d fix(APIInvite): channel can be null (#182)
BREAKING CHANGE: this marks the channel property of invites as possibly null
2021-12-07 22:57:28 +02:00
Suneet Tipirneni
e9d02a19fc feat: add support for user guild member read oauth2 scope and route (#254) 2021-12-07 22:25:50 +02:00
Suneet Tipirneni
9e619fc460 feat(RESTJSONErrorCodes): add error 20029 (#257) 2021-12-07 19:26:01 +02:00
Jiralite
b01716bf22 feat: Add API error code 50055 (#256) 2021-12-07 01:29:36 +02:00
Suneet Tipirneni
c7efcd5505 feat(APIAuditLog): add guild_scheduled_events prop (#251) 2021-12-01 10:17:08 +02:00
145 changed files with 6699 additions and 4993 deletions

View File

@@ -1,3 +1,39 @@
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
### Bug Fixes
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
### Features
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
### Cleanups
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
### BREAKING CHANGES
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
- **APIInvite:** this marks the channel property of invites as possibly null
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
### Bug Fixes

View File

@@ -1,3 +1,39 @@
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
### Bug Fixes
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
### Features
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
### Cleanups
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
### BREAKING CHANGES
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
- **APIInvite:** this marks the channel property of invites as possibly null
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
### Bug Fixes

View File

@@ -1568,7 +1568,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -302,6 +302,9 @@ export type GatewayDispatchPayload =
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayMessageUpdateDispatch
| GatewayPresenceUpdateDispatch
| GatewayStageInstanceCreateDispatch
| GatewayStageInstanceDeleteDispatch
| GatewayStageInstanceUpdateDispatch
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayThreadListSyncDispatch
@@ -1257,7 +1260,7 @@ export type GatewayThreadMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#thread-member-update
*/
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember;
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#thread-create
@@ -1657,7 +1660,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -540,7 +540,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
* @internal
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
interface AuditLogChangeData<K extends string, D extends unknown> {
interface AuditLogChangeData<K extends string, D> {
key: K;
new_value?: D;
old_value?: D;

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { ChannelType } from '../../../channel.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandIntegerOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataIntegerOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,11 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandMentionableOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandNumberOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandNumberOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataNumberOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;

View File

@@ -0,0 +1,23 @@
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
value: ValueType;
}

View File

@@ -0,0 +1,16 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandOptionChoice<string>
>;
export interface APIApplicationCommandInteractionDataStringOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}

View File

@@ -0,0 +1,14 @@
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandSubcommandOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
options?: APIApplicationCommandBasicOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandOption {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataBasicOption[];
}

View File

@@ -0,0 +1,17 @@
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
import type {
APIApplicationCommandInteractionDataSubcommandOption,
APIApplicationCommandSubcommandOption,
} from './subcommand.ts';
export interface APIApplicationCommandSubcommandGroupOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
options?: APIApplicationCommandSubcommandOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: APIApplicationCommandInteractionDataSubcommandOption[];
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;

View File

@@ -1,232 +1,105 @@
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIRole, APIUser } from '../../mod.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
import type {
APIApplicationCommandStringOption,
APIApplicationCommandInteractionDataStringOption,
} from './_chatInput/string.ts';
import type {
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandInteractionDataIntegerOption,
} from './_chatInput/integer.ts';
import type {
APIApplicationCommandBooleanOption,
APIApplicationCommandInteractionDataBooleanOption,
} from './_chatInput/boolean.ts';
import type {
APIApplicationCommandUserOption,
APIApplicationCommandInteractionDataUserOption,
} from './_chatInput/user.ts';
import type {
APIApplicationCommandChannelOption,
APIApplicationCommandInteractionDataChannelOption,
} from './_chatInput/channel.ts';
import type {
APIApplicationCommandRoleOption,
APIApplicationCommandInteractionDataRoleOption,
} from './_chatInput/role.ts';
import type {
APIApplicationCommandMentionableOption,
APIApplicationCommandInteractionDataMentionableOption,
} from './_chatInput/mentionable.ts';
import type {
APIApplicationCommandNumberOptionBase,
APIApplicationCommandInteractionDataNumberOption,
} from './_chatInput/number.ts';
import type {
APIApplicationCommandSubcommandOption,
APIApplicationCommandInteractionDataSubcommandOption,
} from './_chatInput/subcommand.ts';
import type {
APIApplicationCommandSubcommandGroupOption,
APIApplicationCommandInteractionDataSubcommandGroupOption,
} from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/string.ts';
export * from './_chatInput/integer.ts';
export * from './_chatInput/boolean.ts';
export * from './_chatInput/user.ts';
export * from './_chatInput/channel.ts';
export * from './_chatInput/role.ts';
export * from './_chatInput/mentionable.ts';
export * from './_chatInput/number.ts';
export * from './_chatInput/subcommand.ts';
export * from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/shared.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandBasicOption =
| APIApplicationCommandStringOption
| APIApplicationCommandIntegerOptionBase
| APIApplicationCommandBooleanOption
| APIApplicationCommandUserOption
| APIApplicationCommandChannelOption
| APIApplicationCommandRoleOption
| APIApplicationCommandMentionableOption
| APIApplicationCommandNumberOptionBase;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
export interface APIApplicationCommandArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
| APIApplicationCommandSubcommandOption
| APIApplicationCommandSubcommandGroupOption
| APIApplicationCommandBasicOption;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
| APIApplicationCommandInteractionDataSubcommandOption
| APIApplicationCommandInteractionDataSubcommandGroupOption
| APIApplicationCommandInteractionDataBasicOption;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;
export interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandInteractionDataBasicOption =
| APIApplicationCommandInteractionDataStringOption
| APIApplicationCommandInteractionDataIntegerOption
| APIApplicationCommandInteractionDataBooleanOption
| APIApplicationCommandInteractionDataUserOption
| APIApplicationCommandInteractionDataChannelOption
| APIApplicationCommandInteractionDataRoleOption
| APIApplicationCommandInteractionDataMentionableOption
| APIApplicationCommandInteractionDataNumberOption;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

View File

@@ -39,7 +39,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* ID of the interaction
*/

View File

@@ -17,7 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -47,6 +51,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* The guild scheduled events in the audit log
*
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events: APIGuildScheduledEvent[];
}
/**
@@ -634,7 +644,7 @@ export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildSched
*/
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
interface AuditLogChangeData<K extends string, D extends unknown> {
interface AuditLogChangeData<K extends string, D> {
key: K;
/**
* The new value

View File

@@ -648,6 +648,10 @@ export interface APIGuildMember {
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
/**
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
}
/**

View File

@@ -1,4 +1,5 @@
import type { APIUser } from './user.ts';
import type { APIGuildMember } from './guild.ts';
import type { Snowflake } from '../../globals.ts';
export interface APIGuildScheduledEvent {
@@ -102,3 +103,21 @@ export enum GuildScheduledEventPrivacyLevel {
*/
GuildOnly = 2,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -28,7 +28,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
channel: Required<APIPartialChannel> | null;
/**
* The user who created the invite
*

View File

@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
*
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
GuildsMembersRead = 'guilds.members.read',
/**
* Allows your app to join users to a group dm
*

View File

@@ -48,6 +48,7 @@ export const PermissionFlagsBits = {
ManageEvents: 1n << 33n,
UseExternalStickers: 1n << 37n,
StartEmbeddedActivities: 1n << 39n,
ModerateMembers: 1n << 40n,
} as const;
/**

View File

@@ -93,7 +93,7 @@ export enum StickerFormatType {
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
*/
export interface APIStickerPack {
/**
@@ -123,5 +123,5 @@ export interface APIStickerPack {
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
banner_asset_id?: Snowflake;
}

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { ChannelType } from '../../../channel.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandIntegerOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataIntegerOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,11 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandMentionableOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandNumberOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandNumberOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataNumberOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;

View File

@@ -0,0 +1,23 @@
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
value: ValueType;
}

View File

@@ -0,0 +1,16 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandOptionChoice<string>
>;
export interface APIApplicationCommandInteractionDataStringOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}

View File

@@ -0,0 +1,14 @@
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandSubcommandOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
options?: APIApplicationCommandBasicOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandOption {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataBasicOption[];
}

View File

@@ -0,0 +1,17 @@
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
import type {
APIApplicationCommandInteractionDataSubcommandOption,
APIApplicationCommandSubcommandOption,
} from './subcommand.ts';
export interface APIApplicationCommandSubcommandGroupOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
options?: APIApplicationCommandSubcommandOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: APIApplicationCommandInteractionDataSubcommandOption[];
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;

View File

@@ -1,228 +1,105 @@
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIRole, APIUser } from '../../mod.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
import type {
APIApplicationCommandStringOption,
APIApplicationCommandInteractionDataStringOption,
} from './_chatInput/string.ts';
import type {
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandInteractionDataIntegerOption,
} from './_chatInput/integer.ts';
import type {
APIApplicationCommandBooleanOption,
APIApplicationCommandInteractionDataBooleanOption,
} from './_chatInput/boolean.ts';
import type {
APIApplicationCommandUserOption,
APIApplicationCommandInteractionDataUserOption,
} from './_chatInput/user.ts';
import type {
APIApplicationCommandChannelOption,
APIApplicationCommandInteractionDataChannelOption,
} from './_chatInput/channel.ts';
import type {
APIApplicationCommandRoleOption,
APIApplicationCommandInteractionDataRoleOption,
} from './_chatInput/role.ts';
import type {
APIApplicationCommandMentionableOption,
APIApplicationCommandInteractionDataMentionableOption,
} from './_chatInput/mentionable.ts';
import type {
APIApplicationCommandNumberOptionBase,
APIApplicationCommandInteractionDataNumberOption,
} from './_chatInput/number.ts';
import type {
APIApplicationCommandSubcommandOption,
APIApplicationCommandInteractionDataSubcommandOption,
} from './_chatInput/subcommand.ts';
import type {
APIApplicationCommandSubcommandGroupOption,
APIApplicationCommandInteractionDataSubcommandGroupOption,
} from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/string.ts';
export * from './_chatInput/integer.ts';
export * from './_chatInput/boolean.ts';
export * from './_chatInput/user.ts';
export * from './_chatInput/channel.ts';
export * from './_chatInput/role.ts';
export * from './_chatInput/mentionable.ts';
export * from './_chatInput/number.ts';
export * from './_chatInput/subcommand.ts';
export * from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/shared.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandBasicOption =
| APIApplicationCommandStringOption
| APIApplicationCommandIntegerOptionBase
| APIApplicationCommandBooleanOption
| APIApplicationCommandUserOption
| APIApplicationCommandChannelOption
| APIApplicationCommandRoleOption
| APIApplicationCommandMentionableOption
| APIApplicationCommandNumberOptionBase;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a either a `choices` or a `autocomplete` field where it's set to false.
*/
export interface APIApplicationCommandStringArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
| APIApplicationCommandSubcommandOption
| APIApplicationCommandSubcommandGroupOption
| APIApplicationCommandBasicOption;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
| APIApplicationCommandInteractionDataSubcommandOption
| APIApplicationCommandInteractionDataSubcommandGroupOption
| APIApplicationCommandInteractionDataBasicOption;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;
export interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandInteractionDataBasicOption =
| APIApplicationCommandInteractionDataStringOption
| APIApplicationCommandInteractionDataIntegerOption
| APIApplicationCommandInteractionDataBooleanOption
| APIApplicationCommandInteractionDataUserOption
| APIApplicationCommandInteractionDataChannelOption
| APIApplicationCommandInteractionDataRoleOption
| APIApplicationCommandInteractionDataMentionableOption
| APIApplicationCommandInteractionDataNumberOption;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

View File

@@ -39,7 +39,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* ID of the interaction
*/

View File

@@ -17,7 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -55,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
/**
* The guild scheduled events in the audit log
*
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events: APIGuildScheduledEvent[];
}
/**
@@ -673,7 +683,7 @@ export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildSched
*/
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
interface AuditLogChangeData<K extends string, D extends unknown> {
interface AuditLogChangeData<K extends string, D> {
key: K;
/**
* The new value

View File

@@ -656,6 +656,10 @@ export interface APIGuildMember {
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
/**
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
}
/**

View File

@@ -1,4 +1,5 @@
import type { APIUser } from './user.ts';
import type { APIGuildMember } from './guild.ts';
import type { Snowflake } from '../../globals.ts';
export interface APIGuildScheduledEvent {
@@ -102,3 +103,21 @@ export enum GuildScheduledEventPrivacyLevel {
*/
GuildOnly = 2,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -28,7 +28,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
channel: Required<APIPartialChannel> | null;
/**
* The user who created the invite
*

View File

@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
*
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
GuildsMembersRead = 'guilds.members.read',
/**
* Allows your app to join users to a group dm
*

View File

@@ -52,6 +52,7 @@ export const PermissionFlagsBits = {
UseExternalStickers: 1n << 37n,
SendMessagesInThreads: 1n << 38n,
StartEmbeddedActivities: 1n << 39n,
ModerateMembers: 1n << 40n,
} as const;
/**

View File

@@ -93,7 +93,7 @@ export enum StickerFormatType {
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
*/
export interface APIStickerPack {
/**
@@ -123,5 +123,5 @@ export interface APIStickerPack {
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
banner_asset_id?: Snowflake;
}

View File

@@ -68,6 +68,7 @@ export enum RESTJSONErrorCodes {
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
ServerSendRateLimit,
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
@@ -158,6 +159,7 @@ export enum RESTJSONErrorCodes {
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50054,
InvalidGuild,
PaymentSourceRequiredToRedeemGift = 50070,
@@ -175,6 +177,8 @@ export enum RESTJSONErrorCodes {
ServerNeedsMoreBoostsToPerformThisAction = 50101,
RequestBodyContainsInvalidJSON = 50109,
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,

View File

@@ -17,6 +17,7 @@ import type {
OverwriteType,
VideoQualityMode,
} from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/channel#get-channel
@@ -26,7 +27,7 @@ export type RESTGetAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
*/
export interface RESTPatchAPIChannelJSONBody {
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character channel name
*
@@ -103,7 +104,7 @@ export interface RESTPatchAPIChannelJSONBody {
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
*/
video_quality_mode?: VideoQualityMode | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
@@ -152,20 +153,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
export type APIMessageReferenceSend = Partial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> & {
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
*
* @default true
*/
fail_if_not_exists?: boolean;
};
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export interface RESTPostAPIChannelMessageJSONBody {
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -188,6 +190,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
* Embedded `rich` content
*
* See https://discord.com/developers/docs/resources/channel#embed-object
* @deprecated Use `embeds` instead
*/
embed?: APIEmbed;
/**
@@ -218,7 +221,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
@@ -291,7 +294,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export interface RESTPatchAPIChannelMessageJSONBody {
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The new message contents (up to 2000 characters)
*/
@@ -331,14 +334,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
/**
* The components to include with the message
*
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
@@ -351,6 +354,7 @@ export type RESTPatchAPIChannelMessageFormDataBody =
payload_json?: string;
} & Record<`files[${bigint}]`, unknown>)
| (RESTPatchAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
@@ -411,7 +415,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
*/
export interface RESTPostAPIChannelInviteJSONBody {
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Duration of invite in seconds before expiry, or 0 for never
*
@@ -455,7 +459,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
@@ -505,7 +509,7 @@ export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
export interface RESTPutAPIChannelRecipientJSONBody {
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Access token of a user that has granted your app the `gdm.join` scope
*/
@@ -514,7 +518,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
* Nickname of the user being added
*/
nick?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
*/
export interface RESTPostAPIGuildEmojiJSONBody {
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji

View File

@@ -20,21 +20,27 @@ import type {
GuildVerificationLevel,
GuildWidgetStyle,
} from '../../payloads/v8/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
Nullable,
StrictPartial,
StrictRequired,
} from '../../utils/internals.ts';
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: number | string;
}
export type APIGuildCreatePartialChannel = Partial<
export type APIGuildCreatePartialChannel = StrictPartial<
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
};
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
}>;
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
@@ -43,7 +49,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
/**
* https://discord.com/developers/docs/resources/guild#create-guild
*/
export interface RESTPostAPIGuildsJSONBody {
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -126,7 +132,7 @@ export interface RESTPostAPIGuildsJSONBody {
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild
@@ -158,7 +164,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
*/
export interface RESTPatchAPIGuildJSONBody {
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* New name for the guild (2-100 characters)
*/
@@ -257,7 +263,7 @@ export interface RESTPatchAPIGuildJSONBody {
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
@@ -287,24 +293,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>;
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
@@ -360,7 +368,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
*/
export interface RESTPutAPIGuildMemberJSONBody {
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
*/
@@ -389,14 +397,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
* Requires `DEAFEN_MEMBERS` permission
*/
deaf?: boolean;
}
}>;
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
*/
export interface RESTPatchAPIGuildMemberJSONBody {
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
@@ -427,7 +435,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
* Requires `MOVE_MEMBERS` permission
*/
channel_id?: Snowflake | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
@@ -437,19 +445,20 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
* Requires `CHANGE_NICKNAME` permission
*/
nick?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
export type RESTPatchAPICurrentGuildMemberNicknameResult =
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
@@ -479,7 +488,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
*/
export interface RESTPutAPIGuildBanJSONBody {
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to delete messages for (0-7)
*/
@@ -488,7 +497,7 @@ export interface RESTPutAPIGuildBanJSONBody {
* Reason for the ban
*/
reason?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
@@ -508,7 +517,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
*/
export interface RESTPostAPIGuildRoleJSONBody {
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*
@@ -518,7 +527,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
/**
* Bitwise value of the enabled/disabled permissions
*
* @default "default role permissions in guild"
* @default "default role permissions in guild"
*/
permissions?: Permissions | null;
/**
@@ -547,7 +556,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
* @default false
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
@@ -557,16 +566,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>;
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
@@ -576,7 +587,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
*/
export interface RESTPatchAPIGuildRoleJSONBody {
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*/
@@ -605,7 +616,7 @@ export interface RESTPatchAPIGuildRoleJSONBody {
* Whether the role should be mentionable
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
@@ -648,7 +659,7 @@ export interface RESTGetAPIGuildPruneCountResult {
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
*/
export interface RESTPostAPIGuildPruneJSONBody {
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to count prune for (1 or more)
*
@@ -665,7 +676,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
* Role(s) to include
*/
include_roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
@@ -702,7 +713,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
*/
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
@@ -742,7 +753,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether Membership Screening is enabled
*/
@@ -755,11 +766,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
* The server description to show in the screening form
*/
description?: string | null;
}
}>;
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -772,9 +783,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}
}>;
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -783,7 +794,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
* Toggles the user's suppress state
*/
suppress?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
@@ -793,9 +804,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}>;

View File

@@ -1,12 +1,12 @@
import type { Snowflake } from '../../globals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildMember,
APIUser,
APIGuildScheduledEventUser,
} from '../../v8.ts';
/**
@@ -27,7 +27,7 @@ export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export interface RESTPostAPIGuildScheduledEventJSONBody {
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The stage channel id of the guild event
*/
@@ -60,7 +60,7 @@ export interface RESTPostAPIGuildScheduledEventJSONBody {
* The entity metadata of the scheduled event
*/
entity_metadata?: APIGuildScheduledEventEntityMetadata;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
@@ -85,12 +85,13 @@ export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
@@ -130,21 +131,3 @@ export interface RESTGetAPIGuildScheduledEventUsersQuery {
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -6,6 +6,7 @@ import type {
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
@@ -25,22 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
/**
* Whether this application command option should be autocompleted
*/
autocomplete?: boolean;
description: string;
}
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
type?: ApplicationCommandType.ChatInput;
description: string;
}>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
@@ -64,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
@@ -104,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command

View File

@@ -441,6 +441,14 @@ export const Routes = {
return `/users/@me/guilds` as const;
},
/**
* Route for:
* - GET `/users/@me/guilds/{guild.id}/member`
*/
userGuildMember(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}/member` as const;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
@@ -790,27 +798,3 @@ export const OAuth2Routes = {
// Freeze OAuth2 route object
Object.freeze(OAuth2Routes);
export interface DiscordErrorFieldInformation {
code: string;
message: string;
}
export interface DiscordErrorGroupWrapper {
_errors: DiscordError[];
}
export type DiscordErrorData =
| DiscordErrorGroupWrapper
| DiscordErrorFieldInformation
| { [k: string]: DiscordErrorData }
| string;
/**
* https://discord.com/developers/docs/reference#error-messages
*/
export interface DiscordError {
code: number;
message: string;
errors?: DiscordErrorData;
}

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
@@ -34,7 +35,7 @@ export type RESTGetAPIStageInstanceResult = APIStageInstance;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
*/
export interface RESTPatchAPIStageInstanceJSONBody {
export type RESTPatchAPIStageInstanceJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The topic of the stage instance (1-120 characters)
*/
@@ -43,7 +44,7 @@ export interface RESTPatchAPIStageInstanceJSONBody {
* The privacy level of the stage instance
*/
privacy_level?: StageInstancePrivacyLevel;
}
}>;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance

View File

@@ -1,4 +1,5 @@
import type { APISticker, APIStickerPack } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
export type RESTGetAPIStickerResult = APISticker;
@@ -31,7 +32,7 @@ export interface RESTPostAPIGuildStickerFormDataBody {
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
export type RESTPatchAPIGuildStickerJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the sticker (2-30 characters)
*/
@@ -44,7 +45,7 @@ export interface RESTPatchAPIGuildStickerJSONBody {
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
}>;
export type RESTPatchAPIGuildStickerResult = APISticker;

View File

@@ -1,4 +1,5 @@
import type { APIGuild, APITemplate } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/template#get-template
@@ -8,7 +9,7 @@ export type RESTGetAPITemplateResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export interface RESTPostAPITemplateCreateGuildJSONBody {
export type RESTPostAPITemplateCreateGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -19,7 +20,8 @@ export interface RESTPostAPITemplateCreateGuildJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
icon?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
@@ -33,7 +35,7 @@ export type RESTGetAPIGuildTemplatesResult = APITemplate[];
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
*/
export interface RESTPostAPIGuildTemplatesJSONBody {
export type RESTPostAPIGuildTemplatesJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the template (1-100 characters)
*/
@@ -42,7 +44,7 @@ export interface RESTPostAPIGuildTemplatesJSONBody {
* Description for the template (0-120 characters)
*/
description?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
@@ -57,7 +59,7 @@ export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template
*/
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
export type RESTPatchAPIGuildTemplateJSONBody = StrictPartial<RESTPostAPIGuildTemplatesJSONBody>;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template

View File

@@ -1,5 +1,6 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
import type { APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user
@@ -11,10 +12,15 @@ export type RESTGetAPICurrentUserResult = APIUser;
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
export type RESTGetCurrentUserGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
*/
export interface RESTPatchAPICurrentUserJSONBody {
export type RESTPatchAPICurrentUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* User's username, if changed may cause the user's discriminator to be randomized
*/
@@ -23,7 +29,7 @@ export interface RESTPatchAPICurrentUserJSONBody {
* If passed, modifies the user's avatar
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user

View File

@@ -7,12 +7,12 @@ import type {
APIWebhook,
APIAttachment,
} from '../../payloads/v8/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
*/
export interface RESTPostAPIChannelWebhookJSONBody {
export type RESTPostAPIChannelWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the webhook (1-80 characters)
*/
@@ -23,7 +23,7 @@ export interface RESTPostAPIChannelWebhookJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
@@ -53,7 +53,7 @@ export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
*/
export interface RESTPatchAPIWebhookJSONBody {
export type RESTPatchAPIWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The default name of the webhook
*/
@@ -68,7 +68,7 @@ export interface RESTPatchAPIWebhookJSONBody {
* The new channel id this webhook should be moved to
*/
channel_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
@@ -98,7 +98,7 @@ export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
@@ -164,6 +164,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
* @default false
*/
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*/
thread_id?: Snowflake;
}
/**
@@ -223,19 +227,18 @@ export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
extends Nullable<
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
> {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
}
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>> & {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
}
>;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message

View File

@@ -20,6 +20,7 @@ import type {
ThreadAutoArchiveDuration,
VideoQualityMode,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/channel#get-channel
@@ -29,7 +30,7 @@ export type RESTGetAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
*/
export interface RESTPatchAPIChannelJSONBody {
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character channel name
*
@@ -136,7 +137,7 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: privateThread
*/
invitable?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
@@ -185,20 +186,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
export type APIMessageReferenceSend = Partial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> & {
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
*
* @default true
*/
fail_if_not_exists?: boolean;
};
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export interface RESTPostAPIChannelMessageJSONBody {
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -252,7 +254,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
@@ -325,7 +327,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export interface RESTPatchAPIChannelMessageJSONBody {
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The new message contents (up to 2000 characters)
*/
@@ -365,14 +367,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
/**
* The components to include with the message
*
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
@@ -446,7 +448,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
*/
export interface RESTPostAPIChannelInviteJSONBody {
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Duration of invite in seconds before expiry, or 0 for never
*
@@ -490,7 +492,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
@@ -540,7 +542,7 @@ export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
export interface RESTPutAPIChannelRecipientJSONBody {
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Access token of a user that has granted your app the `gdm.join` scope
*/
@@ -549,7 +551,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
* Nickname of the user being added
*/
nick?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
@@ -564,7 +566,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
export type RESTPostAPIChannelMessagesThreadsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character thread name
*/
@@ -579,7 +581,7 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
* Amount of seconds a user has to wait before sending another message (0-21600)
*/
rate_limit_per_user?: number;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
@@ -589,23 +591,24 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-without-message
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}
export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-without-message

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
*/
export interface RESTPostAPIGuildEmojiJSONBody {
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji

View File

@@ -21,21 +21,27 @@ import type {
GuildVerificationLevel,
GuildWidgetStyle,
} from '../../payloads/v9/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
Nullable,
StrictPartial,
StrictRequired,
} from '../../utils/internals.ts';
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: number | string;
}
export type APIGuildCreatePartialChannel = Partial<
export type APIGuildCreatePartialChannel = StrictPartial<
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
};
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
}>;
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
@@ -44,7 +50,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
/**
* https://discord.com/developers/docs/resources/guild#create-guild
*/
export interface RESTPostAPIGuildsJSONBody {
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -127,7 +133,7 @@ export interface RESTPostAPIGuildsJSONBody {
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild
@@ -159,7 +165,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
*/
export interface RESTPatchAPIGuildJSONBody {
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* New name for the guild (2-100 characters)
*/
@@ -258,7 +264,7 @@ export interface RESTPatchAPIGuildJSONBody {
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
@@ -288,24 +294,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>;
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
@@ -366,7 +374,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
*/
export interface RESTPutAPIGuildMemberJSONBody {
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
*/
@@ -395,14 +403,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
* Requires `DEAFEN_MEMBERS` permission
*/
deaf?: boolean;
}
}>;
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
*/
export interface RESTPatchAPIGuildMemberJSONBody {
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
@@ -433,7 +441,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
* Requires `MOVE_MEMBERS` permission
*/
channel_id?: Snowflake | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
@@ -443,19 +451,20 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
* Requires `CHANGE_NICKNAME` permission
*/
nick?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
export type RESTPatchAPICurrentGuildMemberNicknameResult =
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
@@ -485,7 +494,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
*/
export interface RESTPutAPIGuildBanJSONBody {
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to delete messages for (0-7)
*/
@@ -494,7 +503,7 @@ export interface RESTPutAPIGuildBanJSONBody {
* Reason for the ban
*/
reason?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
@@ -514,7 +523,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
*/
export interface RESTPostAPIGuildRoleJSONBody {
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*
@@ -524,7 +533,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
/**
* Bitwise value of the enabled/disabled permissions
*
* @default "default role permissions in guild"
* @default "default role permissions in guild"
*/
permissions?: Permissions | null;
/**
@@ -553,7 +562,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
* @default false
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
@@ -563,16 +572,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>;
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
@@ -582,7 +593,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
*/
export interface RESTPatchAPIGuildRoleJSONBody {
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*/
@@ -611,7 +622,7 @@ export interface RESTPatchAPIGuildRoleJSONBody {
* Whether the role should be mentionable
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
@@ -654,7 +665,7 @@ export interface RESTGetAPIGuildPruneCountResult {
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
*/
export interface RESTPostAPIGuildPruneJSONBody {
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to count prune for (1 or more)
*
@@ -671,7 +682,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
* Role(s) to include
*/
include_roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
@@ -708,7 +719,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
*/
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
@@ -748,7 +759,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether Membership Screening is enabled
*/
@@ -761,11 +772,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
* The server description to show in the screening form
*/
description?: string | null;
}
}>;
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -778,9 +789,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}
}>;
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -789,7 +800,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
* Toggles the user's suppress state
*/
suppress?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
@@ -799,9 +810,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}>;

View File

@@ -1,12 +1,12 @@
import type { Snowflake } from '../../globals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildMember,
APIUser,
APIGuildScheduledEventUser,
} from '../../v9.ts';
/**
@@ -27,7 +27,7 @@ export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export interface RESTPostAPIGuildScheduledEventJSONBody {
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The stage channel id of the guild event
*/
@@ -60,7 +60,7 @@ export interface RESTPostAPIGuildScheduledEventJSONBody {
* The entity metadata of the scheduled event
*/
entity_metadata?: APIGuildScheduledEventEntityMetadata;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
@@ -85,12 +85,13 @@ export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
@@ -130,21 +131,3 @@ export interface RESTGetAPIGuildScheduledEventUsersQuery {
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -6,6 +6,7 @@ import type {
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
@@ -25,22 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
/**
* Whether this application command option should be autocompleted
*/
autocomplete?: boolean;
description: string;
}
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
type?: ApplicationCommandType.ChatInput;
description: string;
}>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
@@ -64,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
@@ -104,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command

View File

@@ -510,6 +510,14 @@ export const Routes = {
return `/users/@me/guilds` as const;
},
/**
* Route for:
* - GET `/users/@me/guilds/{guild.id}/member`
*/
userGuildMember(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}/member` as const;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
@@ -34,7 +35,7 @@ export type RESTGetAPIStageInstanceResult = APIStageInstance;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
*/
export interface RESTPatchAPIStageInstanceJSONBody {
export type RESTPatchAPIStageInstanceJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The topic of the stage instance (1-120 characters)
*/
@@ -43,7 +44,7 @@ export interface RESTPatchAPIStageInstanceJSONBody {
* The privacy level of the stage instance
*/
privacy_level?: StageInstancePrivacyLevel;
}
}>;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance

View File

@@ -1,4 +1,5 @@
import type { APISticker, APIStickerPack } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
export type RESTGetAPIStickerResult = APISticker;
@@ -31,7 +32,7 @@ export interface RESTPostAPIGuildStickerFormDataBody {
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
export type RESTPatchAPIGuildStickerJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the sticker (2-30 characters)
*/
@@ -44,7 +45,7 @@ export interface RESTPatchAPIGuildStickerJSONBody {
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
}>;
export type RESTPatchAPIGuildStickerResult = APISticker;

View File

@@ -1,4 +1,5 @@
import type { APIGuild, APITemplate } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/template#get-template
@@ -8,7 +9,7 @@ export type RESTGetAPITemplateResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export interface RESTPostAPITemplateCreateGuildJSONBody {
export type RESTPostAPITemplateCreateGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -19,7 +20,8 @@ export interface RESTPostAPITemplateCreateGuildJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
icon?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
@@ -33,7 +35,7 @@ export type RESTGetAPIGuildTemplatesResult = APITemplate[];
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
*/
export interface RESTPostAPIGuildTemplatesJSONBody {
export type RESTPostAPIGuildTemplatesJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the template (1-100 characters)
*/
@@ -42,7 +44,7 @@ export interface RESTPostAPIGuildTemplatesJSONBody {
* Description for the template (0-120 characters)
*/
description?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
@@ -57,7 +59,7 @@ export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template
*/
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
export type RESTPatchAPIGuildTemplateJSONBody = StrictPartial<RESTPostAPIGuildTemplatesJSONBody>;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template

View File

@@ -1,5 +1,6 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v9/mod.ts';
import type { APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user
@@ -11,10 +12,15 @@ export type RESTGetAPICurrentUserResult = APIUser;
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
export type RESTGetCurrentUserGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
*/
export interface RESTPatchAPICurrentUserJSONBody {
export type RESTPatchAPICurrentUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* User's username, if changed may cause the user's discriminator to be randomized
*/
@@ -23,7 +29,7 @@ export interface RESTPatchAPICurrentUserJSONBody {
* If passed, modifies the user's avatar
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user

View File

@@ -7,12 +7,12 @@ import type {
APIWebhook,
APIAttachment,
} from '../../payloads/v9/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
*/
export interface RESTPostAPIChannelWebhookJSONBody {
export type RESTPostAPIChannelWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the webhook (1-80 characters)
*/
@@ -23,7 +23,7 @@ export interface RESTPostAPIChannelWebhookJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
@@ -53,7 +53,7 @@ export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
*/
export interface RESTPatchAPIWebhookJSONBody {
export type RESTPatchAPIWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The default name of the webhook
*/
@@ -68,7 +68,7 @@ export interface RESTPatchAPIWebhookJSONBody {
* The new channel id this webhook should be moved to
*/
channel_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
@@ -98,7 +98,7 @@ export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
@@ -227,19 +227,18 @@ export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
extends Nullable<
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
> {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
}
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>> & {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
}
>;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message

View File

@@ -1,3 +1,15 @@
export type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
/**
* Allows support for TS 4.5's `exactOptionalPropertyTypes` option by ensuring a property present and undefined is valid
* (since JSON.stringify ignores undefined properties)
*/
export type AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base> = {
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined> ? Base[K] : Base[K] | undefined;
};
export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<Base>>;
export type StrictRequired<Base> = Required<{ [K in keyof Base]: Exclude<Base[K], undefined> }>;

View File

@@ -1568,7 +1568,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -302,6 +302,9 @@ export type GatewayDispatchPayload =
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayMessageUpdateDispatch
| GatewayPresenceUpdateDispatch
| GatewayStageInstanceCreateDispatch
| GatewayStageInstanceDeleteDispatch
| GatewayStageInstanceUpdateDispatch
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayThreadListSyncDispatch
@@ -1257,7 +1260,7 @@ export type GatewayThreadMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#thread-member-update
*/
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember;
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#thread-create
@@ -1657,7 +1660,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

7778
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,7 @@
{
"name": "discord-api-types",
"version": "0.25.2",
"version": "0.26.0",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./v9.js",
"module": "./v9.mjs",
"types": "./v9.d.ts",
"exports": {
"./globals": {
@@ -112,29 +110,29 @@
"node": ">=12"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/eslint-parser": "^7.14.7",
"@babel/core": "^7.16.5",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-syntax-top-level-await": "^7.14.5",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-angular": "^12.1.4",
"@types/node": "^16.3.3",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-angular": "^15.0.0",
"@types/node": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.30.0",
"eslint-config-marine": "^9.0.6",
"eslint": "^8.5.0",
"eslint-config-marine": "^9.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"gen-esm-wrapper": "^1.1.2",
"husky": "^7.0.1",
"is-ci": "^3.0.0",
"lint-staged": "^11.0.1",
"eslint-plugin-prettier": "^4.0.0",
"gen-esm-wrapper": "^1.1.3",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"lint-staged": "^12.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"tsd": "^0.17.0",
"typescript": "^4.3.5"
"tsd": "^0.19.0",
"typescript": "^4.5.4"
},
"repository": {
"type": "git",

View File

@@ -540,7 +540,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
* @internal
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
interface AuditLogChangeData<K extends string, D extends unknown> {
interface AuditLogChangeData<K extends string, D> {
key: K;
new_value?: D;
old_value?: D;

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals';
import type { ChannelType } from '../../../channel';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandIntegerOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataIntegerOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,11 @@
import type { Snowflake } from '../../../../../globals';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandMentionableOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandNumberOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandNumberOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataNumberOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;

View File

@@ -0,0 +1,23 @@
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
value: ValueType;
}

View File

@@ -0,0 +1,16 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandOptionChoice<string>
>;
export interface APIApplicationCommandInteractionDataStringOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}

View File

@@ -0,0 +1,14 @@
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput';
import type { APIApplicationCommandOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandSubcommandOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
options?: APIApplicationCommandBasicOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandOption {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataBasicOption[];
}

View File

@@ -0,0 +1,17 @@
import type { APIApplicationCommandOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
import type {
APIApplicationCommandInteractionDataSubcommandOption,
APIApplicationCommandSubcommandOption,
} from './subcommand';
export interface APIApplicationCommandSubcommandGroupOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
options?: APIApplicationCommandSubcommandOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: APIApplicationCommandInteractionDataSubcommandOption[];
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;

View File

@@ -1,232 +1,105 @@
import type { APIRole, APIUser, ChannelType } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type { APIRole, APIUser } from '../../index';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type { APIBaseApplicationCommandInteractionData } from './internals';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
import type {
APIApplicationCommandStringOption,
APIApplicationCommandInteractionDataStringOption,
} from './_chatInput/string';
import type {
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandInteractionDataIntegerOption,
} from './_chatInput/integer';
import type {
APIApplicationCommandBooleanOption,
APIApplicationCommandInteractionDataBooleanOption,
} from './_chatInput/boolean';
import type {
APIApplicationCommandUserOption,
APIApplicationCommandInteractionDataUserOption,
} from './_chatInput/user';
import type {
APIApplicationCommandChannelOption,
APIApplicationCommandInteractionDataChannelOption,
} from './_chatInput/channel';
import type {
APIApplicationCommandRoleOption,
APIApplicationCommandInteractionDataRoleOption,
} from './_chatInput/role';
import type {
APIApplicationCommandMentionableOption,
APIApplicationCommandInteractionDataMentionableOption,
} from './_chatInput/mentionable';
import type {
APIApplicationCommandNumberOptionBase,
APIApplicationCommandInteractionDataNumberOption,
} from './_chatInput/number';
import type {
APIApplicationCommandSubcommandOption,
APIApplicationCommandInteractionDataSubcommandOption,
} from './_chatInput/subcommand';
import type {
APIApplicationCommandSubcommandGroupOption,
APIApplicationCommandInteractionDataSubcommandGroupOption,
} from './_chatInput/subcommandGroup';
export * from './_chatInput/string';
export * from './_chatInput/integer';
export * from './_chatInput/boolean';
export * from './_chatInput/user';
export * from './_chatInput/channel';
export * from './_chatInput/role';
export * from './_chatInput/mentionable';
export * from './_chatInput/number';
export * from './_chatInput/subcommand';
export * from './_chatInput/subcommandGroup';
export * from './_chatInput/shared';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandBasicOption =
| APIApplicationCommandStringOption
| APIApplicationCommandIntegerOptionBase
| APIApplicationCommandBooleanOption
| APIApplicationCommandUserOption
| APIApplicationCommandChannelOption
| APIApplicationCommandRoleOption
| APIApplicationCommandMentionableOption
| APIApplicationCommandNumberOptionBase;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
export interface APIApplicationCommandArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
| APIApplicationCommandSubcommandOption
| APIApplicationCommandSubcommandGroupOption
| APIApplicationCommandBasicOption;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
| APIApplicationCommandInteractionDataSubcommandOption
| APIApplicationCommandInteractionDataSubcommandGroupOption
| APIApplicationCommandInteractionDataBasicOption;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;
export interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandInteractionDataBasicOption =
| APIApplicationCommandInteractionDataStringOption
| APIApplicationCommandInteractionDataIntegerOption
| APIApplicationCommandInteractionDataBooleanOption
| APIApplicationCommandInteractionDataUserOption
| APIApplicationCommandInteractionDataChannelOption
| APIApplicationCommandInteractionDataRoleOption
| APIApplicationCommandInteractionDataMentionableOption
| APIApplicationCommandInteractionDataNumberOption;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

View File

@@ -39,7 +39,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* ID of the interaction
*/

View File

@@ -17,7 +17,11 @@ import type { StickerFormatType } from './sticker';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
import type { StageInstancePrivacyLevel } from './stageInstance';
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} from './guildScheduledEvent';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -47,6 +51,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* The guild scheduled events in the audit log
*
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events: APIGuildScheduledEvent[];
}
/**
@@ -634,7 +644,7 @@ export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildSched
*/
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
interface AuditLogChangeData<K extends string, D extends unknown> {
interface AuditLogChangeData<K extends string, D> {
key: K;
/**
* The new value

View File

@@ -648,6 +648,10 @@ export interface APIGuildMember {
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
/**
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
}
/**

View File

@@ -1,4 +1,5 @@
import type { APIUser } from './user';
import type { APIGuildMember } from './guild';
import type { Snowflake } from '../../globals';
export interface APIGuildScheduledEvent {
@@ -102,3 +103,21 @@ export const enum GuildScheduledEventPrivacyLevel {
*/
GuildOnly = 2,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -28,7 +28,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
channel: Required<APIPartialChannel> | null;
/**
* The user who created the invite
*

View File

@@ -40,6 +40,12 @@ export const enum OAuth2Scopes {
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
*
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
GuildsMembersRead = 'guilds.members.read',
/**
* Allows your app to join users to a group dm
*

View File

@@ -48,6 +48,7 @@ export const PermissionFlagsBits = {
ManageEvents: 1n << 33n,
UseExternalStickers: 1n << 37n,
StartEmbeddedActivities: 1n << 39n,
ModerateMembers: 1n << 40n,
} as const;
/**

View File

@@ -93,7 +93,7 @@ export const enum StickerFormatType {
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
*/
export interface APIStickerPack {
/**
@@ -123,5 +123,5 @@ export interface APIStickerPack {
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
banner_asset_id?: Snowflake;
}

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals';
import type { ChannelType } from '../../../channel';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

Some files were not shown because too many files have changed in this diff Show More