mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Merge pull request #869 from discordeno/types-interaction
types(interaction): add missing types & fix invalid ones
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum DiscordApplicationCommandPermissionTypes {
|
||||
Role = 1,
|
||||
User,
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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<GuildApplicationCommandPermissions>;
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user