2025-06-14 05:36:37 +00:00
|
|
|
import { Intents, InteractionTypes } from "@discordeno/types";
|
|
|
|
|
import type { Bot, DesiredPropertiesBehavior, CompleteDesiredProperties } from "discordeno";
|
|
|
|
|
export const intents = [
|
2025-02-27 03:56:30 +00:00
|
|
|
Intents.GuildModeration ,
|
|
|
|
|
Intents.GuildWebhooks ,
|
|
|
|
|
Intents.GuildExpressions ,
|
|
|
|
|
Intents.GuildScheduledEvents ,
|
|
|
|
|
Intents.GuildMessagePolls ,
|
|
|
|
|
Intents.GuildIntegrations ,
|
|
|
|
|
Intents.GuildInvites ,
|
|
|
|
|
Intents.GuildMessageReactions ,
|
|
|
|
|
Intents.GuildPresences ,
|
|
|
|
|
Intents.DirectMessages ,
|
|
|
|
|
Intents.DirectMessageReactions ,
|
|
|
|
|
Intents.GuildMembers ,
|
|
|
|
|
Intents.Guilds ,
|
|
|
|
|
Intents.GuildInvites ,
|
|
|
|
|
Intents.GuildMessages,
|
2025-03-01 21:10:31 +00:00
|
|
|
] as const
|
|
|
|
|
|
2025-06-14 05:36:37 +00:00
|
|
|
export const createBotParameters = {
|
2025-03-01 21:10:31 +00:00
|
|
|
intents: intents.reduce((acc, curr) => acc | curr, Intents.Guilds),
|
|
|
|
|
desiredProperties: {
|
|
|
|
|
interaction: {
|
|
|
|
|
id: true,
|
|
|
|
|
data: true,
|
|
|
|
|
type: true,
|
|
|
|
|
token: true,
|
|
|
|
|
message: true,
|
|
|
|
|
channelId: true,
|
|
|
|
|
channel: true,
|
|
|
|
|
guildId: true,
|
|
|
|
|
guild: true,
|
|
|
|
|
user: true,
|
|
|
|
|
member: true,
|
|
|
|
|
},
|
|
|
|
|
message: {
|
|
|
|
|
id: true,
|
|
|
|
|
member: true,
|
|
|
|
|
guildId: true,
|
|
|
|
|
},
|
|
|
|
|
}
|
2025-06-14 05:36:37 +00:00
|
|
|
} as const
|
|
|
|
|
|
|
|
|
|
// Extract the type of desired properties from our parameters
|
|
|
|
|
type ExtractedDesiredProperties = typeof createBotParameters.desiredProperties;
|
|
|
|
|
|
|
|
|
|
// The BotType uses the CompleteDesiredProperties helper to fill in the missing properties
|
|
|
|
|
export type BotType = Bot<CompleteDesiredProperties<ExtractedDesiredProperties>, DesiredPropertiesBehavior.RemoveKey>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Type for the interaction reference passed to workflows/activities
|
|
|
|
|
export interface InteractionRef {
|
|
|
|
|
id: bigint;
|
|
|
|
|
token: string;
|
|
|
|
|
type: InteractionTypes;
|
|
|
|
|
acknowledged?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Type for the interaction data payload
|
|
|
|
|
export type InteractionData = Parameters<NonNullable<BotType['events']['interactionCreate']>>[0]['data'];
|
2025-02-27 03:56:30 +00:00
|
|
|
|
2025-06-14 05:36:37 +00:00
|
|
|
// Type for the complete interaction handling payload
|
|
|
|
|
export interface InteractionCreatePayload {
|
|
|
|
|
ref: InteractionRef;
|
|
|
|
|
data: InteractionData;
|
|
|
|
|
}
|