diff --git a/src/types/interactions/application_command.ts b/src/types/interactions/application_command.ts index 9a3df0bc3..24cae6c8d 100644 --- a/src/types/interactions/application_command.ts +++ b/src/types/interactions/application_command.ts @@ -12,6 +12,8 @@ export interface ApplicationCommand { description: string; /** The parameters for the command */ options?: ApplicationCommandOption[]; + /** Whether the command is enbaled by default when the app is added to a guild */ + defaultPermission?: boolean; } /** https://discord.com/developers/docs/interactions/slash-commands#applicationcommand */ diff --git a/src/types/interactions/application_command_permission_types.ts b/src/types/interactions/application_command_permission_types.ts new file mode 100644 index 000000000..db383458c --- /dev/null +++ b/src/types/interactions/application_command_permission_types.ts @@ -0,0 +1,4 @@ +export enum DiscordApplicationCommandPermissionTypes { + Role = 1, + User, +} diff --git a/src/types/interactions/application_command_permissions.ts b/src/types/interactions/application_command_permissions.ts new file mode 100644 index 000000000..48453dfeb --- /dev/null +++ b/src/types/interactions/application_command_permissions.ts @@ -0,0 +1,14 @@ +import { DiscordApplicationCommandPermissionTypes } from "./application_command_permission_types.ts"; + +export interface ApplicationCommandPermissions { + /** The id of the role or user */ + id: string; + /** Role or User */ + type: DiscordApplicationCommandPermissionTypes; + /** `true` to allow, `false`, to disallow */ + permission: boolean; +} + +/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissions */ +export type DiscordApplicationCommandPermissions = + ApplicationCommandPermissions; diff --git a/src/types/interactions/guild_application_command_permissions.ts b/src/types/interactions/guild_application_command_permissions.ts new file mode 100644 index 000000000..6845e90d7 --- /dev/null +++ b/src/types/interactions/guild_application_command_permissions.ts @@ -0,0 +1,17 @@ +import { SnakeCasedPropertiesDeep } from "../util.ts"; +import { ApplicationCommandPermissions } from "./application_command_permissions.ts"; + +export interface GuildApplicationCommandPermissions { + /** The id of the command */ + id: string; + /** The id of the application to command belongs to */ + applicationId: string; + /** The id of the guild */ + guildId: string; + /** The permissions for the command in the guild */ + permissions: ApplicationCommandPermissions[]; +} + +/** https://discord.com/developers/docs/interactions/slash-commands#guildapplicationcommandpermissions */ +export type DiscordGuildApplicationCommandPermissions = + SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/interaction.ts b/src/types/interactions/interaction.ts index b8aed2254..a2b8b66f7 100644 --- a/src/types/interactions/interaction.ts +++ b/src/types/interactions/interaction.ts @@ -1,22 +1,24 @@ -import { GuildMember } from "../guilds/guild_member.ts"; +import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { User } from "../users/user.ts"; import { SnakeCasedPropertiesDeep } from "../util.ts"; -import { InteractionApplicationCommandCallbackData } from "./application_command_callback_data.ts"; +import { ApplicationCommandInteractionData } from "./application_command_interaction_data.ts"; import { DiscordInteractionTypes } from "./interaction_types.ts"; export interface Interaction { - /** id of the interaction */ + /** Id of the interaction */ id: string; + /** Id of the application this interaction is for */ + applicationId: string; /** The type of interaction */ type: DiscordInteractionTypes; /** The command data payload */ - data?: InteractionApplicationCommandCallbackData; + data?: ApplicationCommandInteractionData; /** The guild it was sent from */ guildId?: string; /** The channel it was sent from */ channelId?: string; /** Guild member data for the invoking user, including permissions */ - member?: GuildMember; + member?: GuildMemberWithUser; /** User object for the invoking user, if invoked in a DM */ user?: User; /** A continuation token for responding to the interaction */