mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 09:59:10 +00:00
feat: add discord interactions worker
This commit is contained in:
parent
dde05c402e
commit
9354047447
36 changed files with 486 additions and 178 deletions
56
packages/types/Interactions.ts
Normal file
56
packages/types/Interactions.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { DiscordUser, Member } from '@roleypoly/types/User';
|
||||
|
||||
export enum InteractionType {
|
||||
PING = 1,
|
||||
APPLICATION_COMMAND = 2,
|
||||
MESSAGE_COMPONENT = 3,
|
||||
}
|
||||
|
||||
export type InteractionRequest = {
|
||||
id: string;
|
||||
application_id: string;
|
||||
token: string;
|
||||
version: 1;
|
||||
type: InteractionType;
|
||||
data?: InteractionData;
|
||||
guild_id?: string;
|
||||
channel_id?: string;
|
||||
member?: Member;
|
||||
user?: DiscordUser;
|
||||
message?: {};
|
||||
};
|
||||
|
||||
export type InteractionRequestCommand = InteractionRequest & {
|
||||
data: InteractionData;
|
||||
};
|
||||
|
||||
export type InteractionData = {
|
||||
id: string;
|
||||
name: string;
|
||||
resolved?: {};
|
||||
options?: {}[];
|
||||
custom_id: string;
|
||||
component_type: string;
|
||||
};
|
||||
|
||||
export enum InteractionCallbackType {
|
||||
PONG = 1,
|
||||
CHANNEL_MESSAGE_WITH_SOURCE = 4,
|
||||
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
|
||||
DEFERRED_UPDATE_MESSAGE = 6,
|
||||
UPDATE_MESSAGE = 7,
|
||||
}
|
||||
|
||||
export type InteractionCallbackData = {
|
||||
tts?: boolean;
|
||||
content?: string;
|
||||
embeds?: {};
|
||||
allowed_mentions?: {};
|
||||
flags?: number;
|
||||
components?: {}[];
|
||||
};
|
||||
|
||||
export type InteractionResponse = {
|
||||
type: InteractionCallbackType;
|
||||
data?: InteractionCallbackData;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue