mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 00:59:09 +00:00
feat: Slash Commands (#337)
* feat: add discord interactions worker * feat(interactions): update CI/CD and terraform to add interactions * chore: fix lint issues * chore: fix build & emulation * fix(interactions): deployment + handler * chore: remove worker-dist via gitignore * feat: add /pickable-roles and /pick-role basis * feat: add pick, remove, and update the general /roleypoly command * fix: lint missing Member import
This commit is contained in:
parent
dde05c402e
commit
066f68ffef
59 changed files with 1219 additions and 248 deletions
|
@ -11,3 +11,8 @@ export type Category = {
|
|||
type: CategoryType;
|
||||
position: number;
|
||||
};
|
||||
|
||||
export type CategorySlug = {
|
||||
roles: Category['roles'];
|
||||
type: Category['type'];
|
||||
};
|
||||
|
|
79
packages/types/Interactions.ts
Normal file
79
packages/types/Interactions.ts
Normal file
|
@ -0,0 +1,79 @@
|
|||
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?: {
|
||||
name: string;
|
||||
type: number;
|
||||
value?: string;
|
||||
}[];
|
||||
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 enum InteractionFlags {
|
||||
EPHEMERAL = 1 << 6,
|
||||
}
|
||||
|
||||
export type InteractionCallbackData = {
|
||||
tts?: boolean;
|
||||
content?: string;
|
||||
embeds?: {};
|
||||
allowed_mentions?: {};
|
||||
flags?: InteractionFlags;
|
||||
components?: {}[];
|
||||
};
|
||||
|
||||
export type InteractionResponse = {
|
||||
type: InteractionCallbackType;
|
||||
data?: InteractionCallbackData;
|
||||
};
|
||||
|
||||
export type Embed = {
|
||||
fields: {
|
||||
name: string;
|
||||
value: string;
|
||||
inline?: boolean;
|
||||
}[];
|
||||
timestamp?: string;
|
||||
title: string;
|
||||
color: number;
|
||||
author?: {
|
||||
name: string;
|
||||
icon_url: string;
|
||||
};
|
||||
};
|
|
@ -1,5 +1,6 @@
|
|||
export * from './Category';
|
||||
export * from './Guild';
|
||||
export * from './Interactions';
|
||||
export * from './Role';
|
||||
export * from './Session';
|
||||
export * from './User';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue