feat(bot): Remove some clutter from desired proprerties intellisense (#4050)

* Remove TBot, Use SetupDesiredProps

* Remove even more clutter from intellisense

* Use type instead of interfaces for some types

This avoids the need for mapped types in Bot

* docs: add info about removing ts clutter to desired props guide

* docs: improve ts clutter section in desired props guide more

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
This commit is contained in:
Fleny
2024-12-28 23:08:15 +05:30
committed by GitHub
co-authored by Awesome Stickz
parent 6abf453319
commit 41219d5417
7 changed files with 501 additions and 345 deletions
+11
View File
@@ -22,6 +22,17 @@ import { type Transformers, createTransformers } from './transformers.js'
* @param options Configurations options used to manage this bot.
* @returns Bot
*/
// Overloads to avoid adding CompleteDesiredProperties if we are given a complete object
export function createBot<
TProps extends TransformersDesiredProperties,
TBehavior extends DesiredPropertiesBehavior = DesiredPropertiesBehavior.RemoveKey,
>(options: CreateBotOptions<TProps, TBehavior>): Bot<TProps, TBehavior>
export function createBot<
TProps extends RecursivePartial<TransformersDesiredProperties>,
TBehavior extends DesiredPropertiesBehavior = DesiredPropertiesBehavior.RemoveKey,
>(options: CreateBotOptions<TProps, TBehavior>): Bot<CompleteDesiredProperties<TProps>, TBehavior>
export function createBot<
TProps extends RecursivePartial<TransformersDesiredProperties>,
TBehavior extends DesiredPropertiesBehavior = DesiredPropertiesBehavior.RemoveKey,
+1 -1
View File
@@ -18,7 +18,7 @@ export function commandOptionsParser<
TProps extends TransformersDesiredProperties & { interaction: { data: true } },
TBehavior extends DesiredPropertiesBehavior,
>(__interaction: SetupDesiredProps<Interaction, TProps, TBehavior>, options?: InteractionDataOption[]): ParsedInteractionOption<TProps, TBehavior> {
// This is necessary as typescript gets really confused when using __interaction alone, as it will say that 'data' does not exist despite it surely exist since we have the WithAtLeast
// This is necessary as typescript gets really confused when using __interaction alone, as it will say that 'data' does not exist despite it surely exist since we have the &
const interaction = __interaction as SetupDesiredProps<
Interaction,
CompleteDesiredProperties<{ interaction: { data: true } }>,
+5 -5
View File
@@ -201,10 +201,10 @@ interface TransformersDesiredPropertiesMetadata extends DesiredPropertiesMetadat
}
}
export function createDesiredPropertiesObject(
desiredProperties: RecursivePartial<TransformersDesiredProperties>,
defaultValue = false,
): TransformersDesiredProperties {
export function createDesiredPropertiesObject<T extends RecursivePartial<TransformersDesiredProperties>, TDefault extends boolean = false>(
desiredProperties: T,
defaultValue: TDefault = false as TDefault,
): CompleteDesiredProperties<T, TDefault> {
return {
activityInstance: {
applicationId: defaultValue,
@@ -719,7 +719,7 @@ export function createDesiredPropertiesObject(
volume: defaultValue,
...desiredProperties.soundboardSound,
},
}
} satisfies TransformersDesiredProperties as CompleteDesiredProperties<T, TDefault>
}
type KeyByValue<TObj, TValue> = {
+63 -56
View File
@@ -1,22 +1,32 @@
import type { DiscordGatewayPayload, DiscordReady, DiscordVoiceChannelEffectAnimationType } from '@discordeno/types'
import type { Collection } from '@discordeno/utils'
import type { DesiredPropertiesBehavior, TransformersDesiredProperties } from './desiredProperties.js'
import type { Bot } from './index.js'
import type { DesiredPropertiesBehavior, SetupDesiredProps, TransformersDesiredProperties } from './desiredProperties.js'
import type {
AuditLogEntry,
AutoModerationActionExecution,
AutoModerationRule,
Channel,
Emoji,
Entitlement,
Guild,
GuildApplicationCommandPermissions,
Integration,
Interaction,
Invite,
Member,
Message,
PresenceUpdate,
Role,
ScheduledEvent,
SoundboardSound,
Sticker,
Subscription,
ThreadMember,
User,
VoiceState,
} from './transformers/types.js'
export interface EventHandlers<
TProps extends TransformersDesiredProperties,
TBehavior extends DesiredPropertiesBehavior,
TBot extends Bot<TProps, TBehavior> = Bot<TProps, TBehavior>,
> {
export type EventHandlers<TProps extends TransformersDesiredProperties, TBehavior extends DesiredPropertiesBehavior> = {
debug: (text: string, ...args: any[]) => unknown
applicationCommandPermissionsUpdate: (command: GuildApplicationCommandPermissions) => unknown
guildAuditLogEntryCreate: (log: AuditLogEntry, guildId: bigint) => unknown
@@ -24,27 +34,27 @@ export interface EventHandlers<
automodRuleUpdate: (rule: AutoModerationRule) => unknown
automodRuleDelete: (rule: AutoModerationRule) => unknown
automodActionExecution: (payload: AutoModerationActionExecution) => unknown
threadCreate: (thread: TBot['transformers']['$inferredTypes']['channel']) => unknown
threadDelete: (thread: TBot['transformers']['$inferredTypes']['channel']) => unknown
threadCreate: (thread: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
threadDelete: (thread: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
threadListSync: (payload: {
guildId: bigint
channelIds?: bigint[]
threads: TBot['transformers']['$inferredTypes']['channel'][]
threads: SetupDesiredProps<Channel, TProps, TBehavior>[]
members: ThreadMember[]
}) => unknown
threadMemberUpdate: (payload: { id: bigint; guildId: bigint; joinedAt: number; flags: number }) => unknown
threadMembersUpdate: (payload: { id: bigint; guildId: bigint; addedMembers?: ThreadMember[]; removedMemberIds?: bigint[] }) => unknown
threadUpdate: (thread: TBot['transformers']['$inferredTypes']['channel']) => unknown
scheduledEventCreate: (event: TBot['transformers']['$inferredTypes']['scheduledEvent']) => unknown
scheduledEventUpdate: (event: TBot['transformers']['$inferredTypes']['scheduledEvent']) => unknown
scheduledEventDelete: (event: TBot['transformers']['$inferredTypes']['scheduledEvent']) => unknown
threadUpdate: (thread: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
scheduledEventCreate: (event: SetupDesiredProps<ScheduledEvent, TProps, TBehavior>) => unknown
scheduledEventUpdate: (event: SetupDesiredProps<ScheduledEvent, TProps, TBehavior>) => unknown
scheduledEventDelete: (event: SetupDesiredProps<ScheduledEvent, TProps, TBehavior>) => unknown
scheduledEventUserAdd: (payload: { guildScheduledEventId: bigint; guildId: bigint; userId: bigint }) => unknown
scheduledEventUserRemove: (payload: { guildScheduledEventId: bigint; guildId: bigint; userId: bigint }) => unknown
ready: (
payload: {
shardId: number
v: number
user: TBot['transformers']['$inferredTypes']['user']
user: SetupDesiredProps<User, TProps, TBehavior>
guilds: bigint[]
sessionId: string
shard?: number[]
@@ -52,31 +62,28 @@ export interface EventHandlers<
},
rawPayload: DiscordReady,
) => unknown
interactionCreate: (interaction: TBot['transformers']['$inferredTypes']['interaction']) => unknown
interactionCreate: (interaction: SetupDesiredProps<Interaction, TProps, TBehavior>) => unknown
integrationCreate: (integration: Integration) => unknown
integrationDelete: (payload: { id: bigint; guildId: bigint; applicationId?: bigint }) => unknown
integrationUpdate: (payload: { guildId: bigint }) => unknown
inviteCreate: (invite: TBot['transformers']['$inferredTypes']['invite']) => unknown
inviteCreate: (invite: SetupDesiredProps<Invite, TProps, TBehavior>) => unknown
inviteDelete: (payload: { channelId: bigint; guildId?: bigint; code: string }) => unknown
guildMemberAdd: (member: TBot['transformers']['$inferredTypes']['member'], user: TBot['transformers']['$inferredTypes']['user']) => unknown
guildMemberRemove: (user: TBot['transformers']['$inferredTypes']['user'], guildId: bigint) => unknown
guildMemberUpdate: (member: TBot['transformers']['$inferredTypes']['member'], user: TBot['transformers']['$inferredTypes']['user']) => unknown
guildStickersUpdate: (payload: { guildId: bigint; stickers: TBot['transformers']['$inferredTypes']['sticker'][] }) => unknown
messageCreate: (message: TBot['transformers']['$inferredTypes']['message']) => unknown
messageDelete: (
payload: { id: bigint; channelId: bigint; guildId?: bigint },
message?: TBot['transformers']['$inferredTypes']['message'],
) => unknown
guildMemberAdd: (member: SetupDesiredProps<Member, TProps, TBehavior>, user: SetupDesiredProps<User, TProps, TBehavior>) => unknown
guildMemberRemove: (user: SetupDesiredProps<User, TProps, TBehavior>, guildId: bigint) => unknown
guildMemberUpdate: (member: SetupDesiredProps<Member, TProps, TBehavior>, user: SetupDesiredProps<User, TProps, TBehavior>) => unknown
guildStickersUpdate: (payload: { guildId: bigint; stickers: SetupDesiredProps<Sticker, TProps, TBehavior>[] }) => unknown
messageCreate: (message: SetupDesiredProps<Message, TProps, TBehavior>) => unknown
messageDelete: (payload: { id: bigint; channelId: bigint; guildId?: bigint }, message?: SetupDesiredProps<Message, TProps, TBehavior>) => unknown
messageDeleteBulk: (payload: { ids: bigint[]; channelId: bigint; guildId?: bigint }) => unknown
messageUpdate: (message: TBot['transformers']['$inferredTypes']['message']) => unknown
messageUpdate: (message: SetupDesiredProps<Message, TProps, TBehavior>) => unknown
reactionAdd: (payload: {
userId: bigint
channelId: bigint
messageId: bigint
guildId?: bigint
member?: TBot['transformers']['$inferredTypes']['member']
user?: TBot['transformers']['$inferredTypes']['user']
emoji: TBot['transformers']['$inferredTypes']['emoji']
member?: SetupDesiredProps<Member, TProps, TBehavior>
user?: SetupDesiredProps<User, TProps, TBehavior>
emoji: SetupDesiredProps<Emoji, TProps, TBehavior>
messageAuthorId?: bigint
burst: boolean
burstColors?: string[]
@@ -86,14 +93,14 @@ export interface EventHandlers<
channelId: bigint
messageId: bigint
guildId?: bigint
emoji: TBot['transformers']['$inferredTypes']['emoji']
emoji: SetupDesiredProps<Emoji, TProps, TBehavior>
burst: boolean
}) => unknown
reactionRemoveEmoji: (payload: {
channelId: bigint
messageId: bigint
guildId?: bigint
emoji: TBot['transformers']['$inferredTypes']['emoji']
emoji: SetupDesiredProps<Emoji, TProps, TBehavior>
}) => unknown
reactionRemoveAll: (payload: { channelId: bigint; messageId: bigint; guildId?: bigint }) => unknown
presenceUpdate: (presence: PresenceUpdate) => unknown
@@ -101,56 +108,56 @@ export interface EventHandlers<
channelId: bigint
guildId: bigint
userId: bigint
emoji?: TBot['transformers']['$inferredTypes']['emoji']
emoji?: SetupDesiredProps<Emoji, TProps, TBehavior>
animationType?: DiscordVoiceChannelEffectAnimationType
animationId?: number
soundId?: bigint | number
soundVolume?: number
}) => unknown
voiceServerUpdate: (payload: { token: string; endpoint?: string; guildId: bigint }) => unknown
voiceStateUpdate: (voiceState: TBot['transformers']['$inferredTypes']['voiceState']) => unknown
channelCreate: (channel: TBot['transformers']['$inferredTypes']['channel']) => unknown
voiceStateUpdate: (voiceState: SetupDesiredProps<VoiceState, TProps, TBehavior>) => unknown
channelCreate: (channel: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
dispatchRequirements: (data: DiscordGatewayPayload, shardId: number) => unknown
channelDelete: (channel: TBot['transformers']['$inferredTypes']['channel']) => unknown
channelDelete: (channel: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
channelPinsUpdate: (data: { guildId?: bigint; channelId: bigint; lastPinTimestamp?: number }) => unknown
channelUpdate: (channel: TBot['transformers']['$inferredTypes']['channel']) => unknown
channelUpdate: (channel: SetupDesiredProps<Channel, TProps, TBehavior>) => unknown
stageInstanceCreate: (data: { id: bigint; guildId: bigint; channelId: bigint; topic: string }) => unknown
stageInstanceDelete: (data: { id: bigint; guildId: bigint; channelId: bigint; topic: string }) => unknown
stageInstanceUpdate: (data: { id: bigint; guildId: bigint; channelId: bigint; topic: string }) => unknown
guildEmojisUpdate: (payload: {
guildId: bigint
emojis: Collection<bigint, TBot['transformers']['$inferredTypes']['emoji']>
emojis: Collection<bigint, SetupDesiredProps<Emoji, TProps, TBehavior>>
}) => unknown
guildBanAdd: (user: TBot['transformers']['$inferredTypes']['user'], guildId: bigint) => unknown
guildBanRemove: (user: TBot['transformers']['$inferredTypes']['user'], guildId: bigint) => unknown
guildCreate: (guild: TBot['transformers']['$inferredTypes']['guild']) => unknown
guildBanAdd: (user: SetupDesiredProps<User, TProps, TBehavior>, guildId: bigint) => unknown
guildBanRemove: (user: SetupDesiredProps<User, TProps, TBehavior>, guildId: bigint) => unknown
guildCreate: (guild: SetupDesiredProps<Guild, TProps, TBehavior>) => unknown
guildDelete: (id: bigint, shardId: number) => unknown
guildUnavailable: (id: bigint, shardId: number) => unknown
guildUpdate: (guild: TBot['transformers']['$inferredTypes']['guild']) => unknown
guildUpdate: (guild: SetupDesiredProps<Guild, TProps, TBehavior>) => unknown
raw: (data: DiscordGatewayPayload, shardId: number) => unknown
roleCreate: (role: TBot['transformers']['$inferredTypes']['role']) => unknown
roleCreate: (role: SetupDesiredProps<Role, TProps, TBehavior>) => unknown
roleDelete: (payload: { guildId: bigint; roleId: bigint }) => unknown
roleUpdate: (role: TBot['transformers']['$inferredTypes']['role']) => unknown
roleUpdate: (role: SetupDesiredProps<Role, TProps, TBehavior>) => unknown
webhooksUpdate: (payload: { channelId: bigint; guildId: bigint }) => unknown
botUpdate: (user: TBot['transformers']['$inferredTypes']['user']) => unknown
botUpdate: (user: SetupDesiredProps<User, TProps, TBehavior>) => unknown
typingStart: (payload: {
guildId: bigint | undefined
channelId: bigint
userId: bigint
timestamp: number
member: TBot['transformers']['$inferredTypes']['member'] | undefined
member: SetupDesiredProps<Member, TProps, TBehavior> | undefined
}) => unknown
entitlementCreate: (entitlement: TBot['transformers']['$inferredTypes']['entitlement']) => unknown
entitlementUpdate: (entitlement: TBot['transformers']['$inferredTypes']['entitlement']) => unknown
entitlementDelete: (entitlement: TBot['transformers']['$inferredTypes']['entitlement']) => unknown
subscriptionCreate: (subscription: TBot['transformers']['$inferredTypes']['subscription']) => unknown
subscriptionUpdate: (subscription: TBot['transformers']['$inferredTypes']['subscription']) => unknown
subscriptionDelete: (subscription: TBot['transformers']['$inferredTypes']['subscription']) => unknown
entitlementCreate: (entitlement: SetupDesiredProps<Entitlement, TProps, TBehavior>) => unknown
entitlementUpdate: (entitlement: SetupDesiredProps<Entitlement, TProps, TBehavior>) => unknown
entitlementDelete: (entitlement: SetupDesiredProps<Entitlement, TProps, TBehavior>) => unknown
subscriptionCreate: (subscription: SetupDesiredProps<Subscription, TProps, TBehavior>) => unknown
subscriptionUpdate: (subscription: SetupDesiredProps<Subscription, TProps, TBehavior>) => unknown
subscriptionDelete: (subscription: SetupDesiredProps<Subscription, TProps, TBehavior>) => unknown
messagePollVoteAdd: (payload: { userId: bigint; channelId: bigint; messageId: bigint; guildId?: bigint; answerId: number }) => unknown
messagePollVoteRemove: (payload: { userId: bigint; channelId: bigint; messageId: bigint; guildId?: bigint; answerId: number }) => unknown
soundboardSoundCreate: (payload: TBot['transformers']['$inferredTypes']['soundboardSound']) => unknown
soundboardSoundUpdate: (payload: TBot['transformers']['$inferredTypes']['soundboardSound']) => unknown
soundboardSoundCreate: (payload: SetupDesiredProps<SoundboardSound, TProps, TBehavior>) => unknown
soundboardSoundUpdate: (payload: SetupDesiredProps<SoundboardSound, TProps, TBehavior>) => unknown
soundboardSoundDelete: (payload: { soundId: bigint; guildId: bigint }) => unknown
soundboardSoundsUpdate: (payload: { soundboardSounds: TBot['transformers']['$inferredTypes']['soundboardSound'][]; guildId: bigint }) => unknown
soundboardSounds: (payload: { soundboardSounds: TBot['transformers']['$inferredTypes']['soundboardSound'][]; guildId: bigint }) => unknown
soundboardSoundsUpdate: (payload: { soundboardSounds: SetupDesiredProps<SoundboardSound, TProps, TBehavior>[]; guildId: bigint }) => unknown
soundboardSounds: (payload: { soundboardSounds: SetupDesiredProps<SoundboardSound, TProps, TBehavior>[]; guildId: bigint }) => unknown
}
+112 -119
View File
@@ -101,18 +101,37 @@ import type {
} from '@discordeno/types'
import { snakelize } from '@discordeno/utils'
import type { Bot } from './bot.js'
import type { DesiredPropertiesBehavior, TransformersDesiredProperties } from './desiredProperties.js'
import type { DesiredPropertiesBehavior, SetupDesiredProps, TransformersDesiredProperties } from './desiredProperties.js'
import type {
Application,
ApplicationCommand,
AutoModerationRule,
Channel,
Emoji,
Entitlement,
Guild,
GuildApplicationCommandPermissions,
GuildOnboarding,
GuildWidget,
GuildWidgetSettings,
Integration,
InteractionCallbackResponse,
Invite,
Member,
Message,
Role,
ScheduledEvent,
Sku,
SoundboardSound,
StageInstance,
Sticker,
StickerPack,
Subscription,
Template,
ThreadMember,
User,
VoiceState,
Webhook,
WelcomeScreen,
} from './transformers/index.js'
@@ -798,44 +817,39 @@ export function createBotHelpers<TProps extends TransformersDesiredProperties, T
}
}
export interface BotHelpers<
TProps extends TransformersDesiredProperties,
TBehavior extends DesiredPropertiesBehavior,
// This is just an alias, not an actual parameter
TBot extends Bot<TProps, TBehavior> = Bot<TProps, TBehavior>,
> {
export type BotHelpers<TProps extends TransformersDesiredProperties, TBehavior extends DesiredPropertiesBehavior> = {
createAutomodRule: (guildId: BigString, options: CreateAutoModerationRuleOptions, reason?: string) => Promise<AutoModerationRule>
createChannel: (guildId: BigString, options: CreateGuildChannel, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['channel']>
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
createApplicationEmoji: (options: CreateApplicationEmoji) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
createChannel: (guildId: BigString, options: CreateGuildChannel, reason?: string) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
createApplicationEmoji: (options: CreateApplicationEmoji) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
createForumThread: (
channelId: BigString,
options: CreateForumPostWithMessage,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['channel']>
) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<ApplicationCommand>
createGuild: (options: CreateGuild) => Promise<TBot['transformers']['$inferredTypes']['guild']>
createGuild: (options: CreateGuild) => Promise<SetupDesiredProps<Guild, TProps, TBehavior>>
createGuildApplicationCommand: (
command: CreateApplicationCommand,
guildId: BigString,
options?: CreateGuildApplicationCommandOptions,
) => Promise<ApplicationCommand>
createGuildFromTemplate: (templateCode: string, options: CreateGuildFromTemplate) => Promise<TBot['transformers']['$inferredTypes']['guild']>
createGuildFromTemplate: (templateCode: string, options: CreateGuildFromTemplate) => Promise<SetupDesiredProps<Guild, TProps, TBehavior>>
createGuildSticker: (
guildId: BigString,
options: CreateGuildStickerOptions,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['sticker']>
) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>>
createGuildTemplate: (guildId: BigString, options: CreateTemplate) => Promise<Template>
createInvite: (channelId: BigString, options?: CreateChannelInvite, reason?: string) => Promise<Camelize<DiscordInvite>>
createRole: (guildId: BigString, options: CreateGuildRole, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['role']>
createRole: (guildId: BigString, options: CreateGuildRole, reason?: string) => Promise<SetupDesiredProps<Role, TProps, TBehavior>>
createScheduledEvent: (
guildId: BigString,
options: CreateScheduledEvent,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['scheduledEvent']>
createStageInstance: (options: CreateStageInstance, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['stageInstance']>
createWebhook: (channelId: BigString, options: CreateWebhook, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['webhook']>
) => Promise<SetupDesiredProps<ScheduledEvent, TProps, TBehavior>>
createStageInstance: (options: CreateStageInstance, reason?: string) => Promise<SetupDesiredProps<StageInstance, TProps, TBehavior>>
createWebhook: (channelId: BigString, options: CreateWebhook, reason?: string) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>>
editApplicationCommandPermissions: (
guildId: BigString,
commandId: BigString,
@@ -848,67 +862,53 @@ export interface BotHelpers<
options: Partial<EditAutoModerationRuleOptions>,
reason?: string,
) => Promise<AutoModerationRule>
editBotProfile: (options: { username?: string; botAvatarURL?: string | null }) => Promise<TBot['transformers']['$inferredTypes']['user']>
editChannel: (channelId: BigString, options: ModifyChannel, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['channel']>
editEmoji: (
guildId: BigString,
id: BigString,
options: ModifyGuildEmoji,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
editApplicationEmoji: (id: BigString, options: ModifyApplicationEmoji) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
editBotProfile: (options: { username?: string; botAvatarURL?: string | null }) => Promise<SetupDesiredProps<User, TProps, TBehavior>>
editChannel: (channelId: BigString, options: ModifyChannel, reason?: string) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
editEmoji: (guildId: BigString, id: BigString, options: ModifyGuildEmoji, reason?: string) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
editApplicationEmoji: (id: BigString, options: ModifyApplicationEmoji) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
editFollowupMessage: (
token: string,
messageId: BigString,
options: InteractionCallbackData,
) => Promise<TBot['transformers']['$inferredTypes']['message']>
) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
editGlobalApplicationCommand: (commandId: BigString, options: CreateApplicationCommand) => Promise<ApplicationCommand>
editGuild: (guildId: BigString, options: ModifyGuild, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['guild']>
editGuild: (guildId: BigString, options: ModifyGuild, reason?: string) => Promise<SetupDesiredProps<Guild, TProps, TBehavior>>
editGuildApplicationCommand: (commandId: BigString, guildId: BigString, options: CreateApplicationCommand) => Promise<ApplicationCommand>
editGuildSticker: (
guildId: BigString,
stickerId: BigString,
options: AtLeastOne<EditGuildStickerOptions>,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['sticker']>
) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>>
editGuildTemplate: (guildId: BigString, templateCode: string, options: ModifyGuildTemplate) => Promise<Template>
editMessage: (channelId: BigString, messageId: BigString, options: EditMessage) => Promise<TBot['transformers']['$inferredTypes']['message']>
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<TBot['transformers']['$inferredTypes']['message']>
editMessage: (channelId: BigString, messageId: BigString, options: EditMessage) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
editOriginalWebhookMessage: (
webhookId: BigString,
token: string,
options: InteractionCallbackData & { threadId?: BigString },
) => Promise<TBot['transformers']['$inferredTypes']['message']>
editRole: (
guildId: BigString,
roleId: BigString,
options: EditGuildRole,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['role']>
editRolePositions: (
guildId: BigString,
options: ModifyRolePositions[],
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['role'][]>
) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
editRole: (guildId: BigString, roleId: BigString, options: EditGuildRole, reason?: string) => Promise<SetupDesiredProps<Role, TProps, TBehavior>>
editRolePositions: (guildId: BigString, options: ModifyRolePositions[], reason?: string) => Promise<SetupDesiredProps<Role, TProps, TBehavior>[]>
editScheduledEvent: (
guildId: BigString,
eventId: BigString,
options: Partial<EditScheduledEvent>,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['scheduledEvent']>
editStageInstance: (channelId: BigString, topic: string, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['stageInstance']>
editWebhook: (webhookId: BigString, options: ModifyWebhook, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['webhook']>
) => Promise<SetupDesiredProps<ScheduledEvent, TProps, TBehavior>>
editStageInstance: (channelId: BigString, topic: string, reason?: string) => Promise<SetupDesiredProps<StageInstance, TProps, TBehavior>>
editWebhook: (webhookId: BigString, options: ModifyWebhook, reason?: string) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>>
editWebhookMessage: (
webhookId: BigString,
token: string,
messageId: BigString,
options: InteractionCallbackData & { threadId?: BigString },
) => Promise<TBot['transformers']['$inferredTypes']['message']>
) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
editWebhookWithToken: (
webhookId: BigString,
token: string,
options: Omit<ModifyWebhook, 'channelId'>,
) => Promise<TBot['transformers']['$inferredTypes']['webhook']>
) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>>
editWelcomeScreen: (guildId: BigString, options: Camelize<DiscordModifyGuildWelcomeScreen>, reason?: string) => Promise<WelcomeScreen>
editWidgetSettings: (guildId: BigString, options: Camelize<DiscordGuildWidgetSettings>, reason?: string) => Promise<GuildWidgetSettings>
editUserApplicationRoleConnection: (
@@ -916,13 +916,9 @@ export interface BotHelpers<
applicationId: BigString,
options: Camelize<DiscordApplicationRoleConnection>,
) => Promise<Camelize<DiscordApplicationRoleConnection>>
executeWebhook: (
webhookId: BigString,
token: string,
options: ExecuteWebhook,
) => Promise<TBot['transformers']['$inferredTypes']['message'] | undefined>
executeWebhook: (webhookId: BigString, token: string, options: ExecuteWebhook) => Promise<SetupDesiredProps<Message, TProps, TBehavior> | undefined>
followAnnouncement: (sourceChannelId: BigString, targetChannelId: BigString) => Promise<Camelize<DiscordFollowedChannel>>
getActiveThreads: (guildId: BigString) => Promise<{ threads: TBot['transformers']['$inferredTypes']['channel'][]; members: ThreadMember[] }>
getActiveThreads: (guildId: BigString) => Promise<{ threads: SetupDesiredProps<Channel, TProps, TBehavior>[]; members: ThreadMember[] }>
getApplicationInfo: () => Promise<Application>
editApplicationInfo: (body: EditApplication) => Promise<Application>
getCurrentAuthenticationInfo: (bearerToken: string) => Promise<Camelize<DiscordCurrentAuthorization>>
@@ -943,61 +939,61 @@ export interface BotHelpers<
getAvailableVoiceRegions: () => Promise<Camelize<DiscordVoiceRegion>[]>
getBan: (guildId: BigString, userId: BigString) => Promise<Camelize<DiscordBan>>
getBans: (guildId: BigString, options?: GetBans) => Promise<Camelize<DiscordBan>[]>
getChannel: (channelId: BigString) => Promise<TBot['transformers']['$inferredTypes']['channel']>
getChannel: (channelId: BigString) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
getChannelInvites: (channelId: BigString) => Promise<Camelize<DiscordInviteMetadata>[]>
getChannels: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['channel'][]>
getChannelWebhooks: (channelId: BigString) => Promise<TBot['transformers']['$inferredTypes']['webhook'][]>
getDmChannel: (userId: BigString) => Promise<TBot['transformers']['$inferredTypes']['channel']>
getGroupDmChannel: (options: GetGroupDmOptions) => Promise<TBot['transformers']['$inferredTypes']['channel']>
getEmoji: (guildId: BigString, emojiId: BigString) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
getApplicationEmoji: (emojiId: BigString) => Promise<TBot['transformers']['$inferredTypes']['emoji']>
getEmojis: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['emoji'][]>
getApplicationEmojis: () => Promise<{ items: TBot['transformers']['$inferredTypes']['emoji'][] }>
getFollowupMessage: (token: string, messageId: BigString) => Promise<TBot['transformers']['$inferredTypes']['message']>
getChannels: (guildId: BigString) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>[]>
getChannelWebhooks: (channelId: BigString) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>[]>
getDmChannel: (userId: BigString) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
getGroupDmChannel: (options: GetGroupDmOptions) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
getEmoji: (guildId: BigString, emojiId: BigString) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
getApplicationEmoji: (emojiId: BigString) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>>
getEmojis: (guildId: BigString) => Promise<SetupDesiredProps<Emoji, TProps, TBehavior>[]>
getApplicationEmojis: () => Promise<{ items: SetupDesiredProps<Emoji, TProps, TBehavior>[] }>
getFollowupMessage: (token: string, messageId: BigString) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
getGatewayBot: () => Promise<Camelize<DiscordGetGatewayBot>>
getGlobalApplicationCommand: (commandId: BigString) => Promise<ApplicationCommand>
getGlobalApplicationCommands: () => Promise<ApplicationCommand[]>
getGuild: (guildId: BigString, options?: { counts?: boolean }) => Promise<TBot['transformers']['$inferredTypes']['guild']>
getGuilds: (bearerToken: string, options?: GetUserGuilds) => Promise<Partial<TBot['transformers']['$inferredTypes']['guild']>[]>
getGuild: (guildId: BigString, options?: { counts?: boolean }) => Promise<SetupDesiredProps<Guild, TProps, TBehavior>>
getGuilds: (bearerToken: string, options?: GetUserGuilds) => Promise<Partial<SetupDesiredProps<Guild, TProps, TBehavior>>[]>
getGuildApplicationCommand: (commandId: BigString, guildId: BigString) => Promise<ApplicationCommand>
getGuildApplicationCommands: (guildId: BigString) => Promise<ApplicationCommand[]>
getGuildPreview: (guildId: BigString) => Promise<Camelize<DiscordGuildPreview>>
getGuildSticker: (guildId: BigString, stickerId: BigString) => Promise<TBot['transformers']['$inferredTypes']['sticker']>
getGuildStickers: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['sticker'][]>
getGuildSticker: (guildId: BigString, stickerId: BigString) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>>
getGuildStickers: (guildId: BigString) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>[]>
getGuildTemplate: (templateCode: string) => Promise<Template>
getGuildTemplates: (guildId: BigString) => Promise<Template[]>
getGuildWebhooks: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['webhook'][]>
getGuildWebhooks: (guildId: BigString) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>[]>
getIntegrations: (guildId: BigString) => Promise<Integration[]>
getInvite: (inviteCode: string, options?: GetInvite) => Promise<TBot['transformers']['$inferredTypes']['invite']>
getInvites: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['invite'][]>
getMessage: (channelId: BigString, messageId: BigString) => Promise<TBot['transformers']['$inferredTypes']['message']>
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<TBot['transformers']['$inferredTypes']['message'][]>
getInvite: (inviteCode: string, options?: GetInvite) => Promise<SetupDesiredProps<Invite, TProps, TBehavior>>
getInvites: (guildId: BigString) => Promise<SetupDesiredProps<Invite, TProps, TBehavior>[]>
getMessage: (channelId: BigString, messageId: BigString) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<SetupDesiredProps<Message, TProps, TBehavior>[]>
getStickerPack: (stickerPackId: BigString) => Promise<StickerPack>
getStickerPacks: () => Promise<StickerPack[]>
getOriginalInteractionResponse: (token: string) => Promise<TBot['transformers']['$inferredTypes']['message']>
getPinnedMessages: (channelId: BigString) => Promise<TBot['transformers']['$inferredTypes']['message'][]>
getOriginalInteractionResponse: (token: string) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
getPinnedMessages: (channelId: BigString) => Promise<SetupDesiredProps<Message, TProps, TBehavior>[]>
getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>
getPrivateJoinedArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>
getPruneCount: (guildId: BigString, options?: GetGuildPruneCountQuery) => Promise<Camelize<DiscordPrunedCount>>
getPublicArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>
getRoles: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['role'][]>
getRole: (guildId: BigString, roleId: BigString) => Promise<TBot['transformers']['$inferredTypes']['role']>
getRoles: (guildId: BigString) => Promise<SetupDesiredProps<Role, TProps, TBehavior>[]>
getRole: (guildId: BigString, roleId: BigString) => Promise<SetupDesiredProps<Role, TProps, TBehavior>>
getScheduledEvent: (
guildId: BigString,
eventId: BigString,
options?: { withUserCount?: boolean },
) => Promise<TBot['transformers']['$inferredTypes']['scheduledEvent']>
getScheduledEvents: (guildId: BigString, options?: GetScheduledEvents) => Promise<TBot['transformers']['$inferredTypes']['scheduledEvent'][]>
) => Promise<SetupDesiredProps<ScheduledEvent, TProps, TBehavior>>
getScheduledEvents: (guildId: BigString, options?: GetScheduledEvents) => Promise<SetupDesiredProps<ScheduledEvent, TProps, TBehavior>[]>
getScheduledEventUsers: (
guildId: BigString,
eventId: BigString,
options?: GetScheduledEventUsers,
) => Promise<Array<{ user: TBot['transformers']['$inferredTypes']['user']; member?: TBot['transformers']['$inferredTypes']['member'] }>>
) => Promise<Array<{ user: SetupDesiredProps<User, TProps, TBehavior>; member?: SetupDesiredProps<Member, TProps, TBehavior> }>>
getSessionInfo: () => Promise<Camelize<DiscordGetGatewayBot>>
getStageInstance: (channelId: BigString) => Promise<TBot['transformers']['$inferredTypes']['stageInstance']>
getOwnVoiceState: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['voiceState']>
getUserVoiceState: (guildId: BigString, userId: BigString) => Promise<TBot['transformers']['$inferredTypes']['voiceState']>
getSticker: (stickerId: BigString) => Promise<TBot['transformers']['$inferredTypes']['sticker']>
getStageInstance: (channelId: BigString) => Promise<SetupDesiredProps<StageInstance, TProps, TBehavior>>
getOwnVoiceState: (guildId: BigString) => Promise<SetupDesiredProps<VoiceState, TProps, TBehavior>>
getUserVoiceState: (guildId: BigString, userId: BigString) => Promise<SetupDesiredProps<VoiceState, TProps, TBehavior>>
getSticker: (stickerId: BigString) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>>
getThreadMember: (channelId: BigString, userId: BigString) => Promise<ThreadMember>
getThreadMembers: (channelId: BigString) => Promise<ThreadMember[]>
getReactions: (
@@ -1005,38 +1001,38 @@ export interface BotHelpers<
messageId: BigString,
reaction: string,
options?: GetReactions,
) => Promise<TBot['transformers']['$inferredTypes']['user'][]>
getUser: (id: BigString) => Promise<TBot['transformers']['$inferredTypes']['user']>
getCurrentUser: (bearerToken: string) => Promise<TBot['transformers']['$inferredTypes']['user']>
) => Promise<SetupDesiredProps<User, TProps, TBehavior>[]>
getUser: (id: BigString) => Promise<SetupDesiredProps<User, TProps, TBehavior>>
getCurrentUser: (bearerToken: string) => Promise<SetupDesiredProps<User, TProps, TBehavior>>
getUserConnections: (bearerToken: string) => Promise<Camelize<DiscordConnection>[]>
getUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnection>>
getVanityUrl: (guildId: BigString) => Promise<Camelize<DiscordVanityUrl>>
getVoiceRegions: (guildId: BigString) => Promise<Camelize<DiscordVoiceRegion>[]>
getWebhook: (webhookId: BigString) => Promise<TBot['transformers']['$inferredTypes']['webhook']>
getWebhook: (webhookId: BigString) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>>
getWebhookMessage: (
webhookId: BigString,
token: string,
messageId: BigString,
options?: GetWebhookMessageOptions,
) => Promise<TBot['transformers']['$inferredTypes']['message']>
getWebhookWithToken: (webhookId: BigString, token: string) => Promise<TBot['transformers']['$inferredTypes']['webhook']>
) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
getWebhookWithToken: (webhookId: BigString, token: string) => Promise<SetupDesiredProps<Webhook, TProps, TBehavior>>
getWelcomeScreen: (guildId: BigString) => Promise<WelcomeScreen>
getWidget: (guildId: BigString) => Promise<GuildWidget>
getWidgetSettings: (guildId: BigString) => Promise<GuildWidgetSettings>
publishMessage: (channelId: BigString, messageId: BigString) => Promise<TBot['transformers']['$inferredTypes']['message']>
sendMessage: (channelId: BigString, options: CreateMessageOptions) => Promise<TBot['transformers']['$inferredTypes']['message']>
sendFollowupMessage: (token: string, options: InteractionCallbackData) => Promise<TBot['transformers']['$inferredTypes']['message']>
publishMessage: (channelId: BigString, messageId: BigString) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
sendMessage: (channelId: BigString, options: CreateMessageOptions) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
sendFollowupMessage: (token: string, options: InteractionCallbackData) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
startThreadWithMessage: (
channelId: BigString,
messageId: BigString,
options: StartThreadWithMessage,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['channel']>
) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
startThreadWithoutMessage: (
channelId: BigString,
options: StartThreadWithoutMessage,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['channel']>
) => Promise<SetupDesiredProps<Channel, TProps, TBehavior>>
syncGuildTemplate: (guildId: BigString) => Promise<Template>
upsertGlobalApplicationCommands: (
commands: CreateApplicationCommand[],
@@ -1047,22 +1043,22 @@ export interface BotHelpers<
commands: CreateApplicationCommand[],
options?: UpsertGuildApplicationCommandOptions,
) => Promise<ApplicationCommand[]>
editBotMember: (guildId: BigString, options: EditBotMemberOptions, reason?: string) => Promise<TBot['transformers']['$inferredTypes']['member']>
editBotMember: (guildId: BigString, options: EditBotMemberOptions, reason?: string) => Promise<SetupDesiredProps<Member, TProps, TBehavior>>
editMember: (
guildId: BigString,
userId: BigString,
options: ModifyGuildMember,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['member']>
getMember: (guildId: BigString, userId: BigString) => Promise<TBot['transformers']['$inferredTypes']['member']>
getCurrentMember: (guildId: BigString, bearerToken: string) => Promise<TBot['transformers']['$inferredTypes']['member']>
getMembers: (guildId: BigString, options: ListGuildMembers) => Promise<TBot['transformers']['$inferredTypes']['member'][]>
) => Promise<SetupDesiredProps<Member, TProps, TBehavior>>
getMember: (guildId: BigString, userId: BigString) => Promise<SetupDesiredProps<Member, TProps, TBehavior>>
getCurrentMember: (guildId: BigString, bearerToken: string) => Promise<SetupDesiredProps<Member, TProps, TBehavior>>
getMembers: (guildId: BigString, options: ListGuildMembers) => Promise<SetupDesiredProps<Member, TProps, TBehavior>[]>
pruneMembers: (guildId: BigString, options: BeginGuildPrune, reason?: string) => Promise<{ pruned: number | null }>
searchMembers: (
guildId: BigString,
query: string,
options?: Omit<SearchMembers, 'query'>,
) => Promise<TBot['transformers']['$inferredTypes']['member'][]>
) => Promise<SetupDesiredProps<Member, TProps, TBehavior>[]>
bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<{ bannedUsers: bigint[]; failedUsers: bigint[] }>
getApplicationActivityInstance: (applicationId: BigString, instanceId: string) => Promise<Camelize<DiscordActivityInstance>>
// functions return Void so dont need any special handling
@@ -1114,43 +1110,40 @@ export interface BotHelpers<
token: string,
options: InteractionResponse,
params?: InteractionCallbackOptions,
) => Promise<void | TBot['transformers']['$inferredTypes']['interactionCallbackResponse']>
) => Promise<void | SetupDesiredProps<InteractionCallbackResponse, TProps, TBehavior>>
triggerTypingIndicator: (channelId: BigString) => Promise<void>
banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan, reason?: string) => Promise<void>
kickMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>
pinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>
unbanMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>
unpinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>
getGuildOnboarding: (guildId: BigString) => Promise<TBot['transformers']['$inferredTypes']['guildOnboarding']>
getGuildOnboarding: (guildId: BigString) => Promise<SetupDesiredProps<GuildOnboarding, TProps, TBehavior>>
editGuildOnboarding: (
guildId: BigString,
options: EditGuildOnboarding,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['guildOnboarding']>
listEntitlements: (applicationId: BigString, options?: GetEntitlements) => Promise<TBot['transformers']['$inferredTypes']['entitlement'][]>
getEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<TBot['transformers']['$inferredTypes']['entitlement']>
createTestEntitlement: (
applicationId: BigString,
body: CreateEntitlement,
) => Promise<Partial<TBot['transformers']['$inferredTypes']['entitlement']>>
) => Promise<SetupDesiredProps<GuildOnboarding, TProps, TBehavior>>
listEntitlements: (applicationId: BigString, options?: GetEntitlements) => Promise<SetupDesiredProps<Entitlement, TProps, TBehavior>[]>
getEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<SetupDesiredProps<Entitlement, TProps, TBehavior>>
createTestEntitlement: (applicationId: BigString, body: CreateEntitlement) => Promise<Partial<SetupDesiredProps<Entitlement, TProps, TBehavior>>>
deleteTestEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>
listSkus: (applicationId: BigString) => Promise<TBot['transformers']['$inferredTypes']['sku'][]>
listSubscriptions: (skuId: BigString, options?: ListSkuSubscriptionsOptions) => Promise<TBot['transformers']['$inferredTypes']['subscription'][]>
getSubscription: (skuId: BigString, subscriptionId: BigString) => Promise<TBot['transformers']['$inferredTypes']['subscription']>
listSkus: (applicationId: BigString) => Promise<SetupDesiredProps<Sku, TProps, TBehavior>[]>
listSubscriptions: (skuId: BigString, options?: ListSkuSubscriptionsOptions) => Promise<SetupDesiredProps<Subscription, TProps, TBehavior>[]>
getSubscription: (skuId: BigString, subscriptionId: BigString) => Promise<SetupDesiredProps<Subscription, TProps, TBehavior>>
sendSoundboardSound: (channelId: BigString, options: SendSoundboardSound) => Promise<void>
listDefaultSoundboardSounds: () => Promise<TBot['transformers']['$inferredTypes']['soundboardSound'][]>
listGuildSoundboardSounds: (guildId: BigString) => Promise<{ items: TBot['transformers']['$inferredTypes']['soundboardSound'][] }>
getGuildSoundboardSound: (guildId: BigString, soundId: BigString) => Promise<TBot['transformers']['$inferredTypes']['soundboardSound']>
listDefaultSoundboardSounds: () => Promise<SetupDesiredProps<SoundboardSound, TProps, TBehavior>[]>
listGuildSoundboardSounds: (guildId: BigString) => Promise<{ items: SetupDesiredProps<SoundboardSound, TProps, TBehavior>[] }>
getGuildSoundboardSound: (guildId: BigString, soundId: BigString) => Promise<SetupDesiredProps<SoundboardSound, TProps, TBehavior>>
createGuildSoundboardSound: (
guildId: BigString,
options: CreateGuildSoundboardSound,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['soundboardSound']>
) => Promise<SetupDesiredProps<SoundboardSound, TProps, TBehavior>>
modifyGuildSoundboardSound: (
guildId: BigString,
soundId: BigString,
options: ModifyGuildSoundboardSound,
reason?: string,
) => Promise<TBot['transformers']['$inferredTypes']['soundboardSound']>
) => Promise<SetupDesiredProps<SoundboardSound, TProps, TBehavior>>
deleteGuildSoundboardSound: (guildId: BigString, soundId: BigString, reason?: string) => Promise<void>
}
+257 -163
View File
@@ -70,33 +70,74 @@ import type {
RecursivePartial,
} from '@discordeno/types'
import type { Bot } from './bot.js'
import { type DesiredPropertiesBehavior, type TransformersDesiredProperties, createDesiredPropertiesObject } from './desiredProperties.js'
import {
type DesiredPropertiesBehavior,
type SetupDesiredProps,
type TransformersDesiredProperties,
createDesiredPropertiesObject,
} from './desiredProperties.js'
import {
type Activity,
type ActivityInstance,
type ActivityLocation,
type Application,
type ApplicationCommand,
type ApplicationCommandOption,
type ApplicationCommandOptionChoice,
type Attachment,
type AuditLogEntry,
type AutoModerationActionExecution,
type AutoModerationRule,
type AvatarDecorationData,
type Channel,
type Component,
type DefaultReactionEmoji,
type Embed,
type Emoji,
type Entitlement,
type ForumTag,
type GetGatewayBot,
type Guild,
type GuildApplicationCommandPermissions,
type GuildOnboarding,
type GuildOnboardingPrompt,
type GuildOnboardingPromptOption,
type GuildWidget,
type GuildWidgetSettings,
type Integration,
type Interaction,
type InteractionCallback,
type InteractionCallbackResponse,
type InteractionDataOption,
type InteractionDataResolved,
type InteractionResource,
type Invite,
type InviteStageInstance,
type Member,
type Message,
type MessageCall,
type MessageInteractionMetadata,
type MessageSnapshot,
type Poll,
type PollMedia,
type PresenceUpdate,
type Role,
type ScheduledEvent,
type ScheduledEventRecurrenceRule,
type Sku,
type SoundboardSound,
type StageInstance,
type Sticker,
type StickerPack,
type Subscription,
type Team,
type Template,
type ThreadMember,
type ThreadMemberGuildCreate,
type User,
type VoiceRegion,
type VoiceState,
type Webhook,
type WelcomeScreen,
transformActivity,
transformActivityInstance,
@@ -178,240 +219,293 @@ import {
} from './transformers/reverse/index.js'
import { bigintToSnowflake, snowflakeToBigint } from './utils.js'
export interface Transformers<
TProps extends TransformersDesiredProperties,
TBehavior extends DesiredPropertiesBehavior,
// This is just an alias, not an actual parameter
TBot extends Bot<TProps, TBehavior> = Bot<TProps, TBehavior>,
> {
export type Transformers<TProps extends TransformersDesiredProperties, TBehavior extends DesiredPropertiesBehavior> = {
customizers: {
activity: (bot: TBot, payload: DiscordActivity, activity: Activity) => any
activity: (bot: Bot<TProps, TBehavior>, payload: DiscordActivity, activity: Activity) => any
activityInstance: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordActivityInstance,
activityInstance: TBot['transformers']['$inferredTypes']['activityInstance'],
activityInstance: SetupDesiredProps<ActivityInstance, TProps, TBehavior>,
) => any
activityLocation: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordActivityLocation,
activityLocation: TBot['transformers']['$inferredTypes']['activityLocation'],
activityLocation: SetupDesiredProps<ActivityLocation, TProps, TBehavior>,
) => any
application: (bot: Bot<TProps, TBehavior>, payload: DiscordApplication, application: Application) => any
applicationCommand: (bot: Bot<TProps, TBehavior>, payload: DiscordApplicationCommand, applicationCommand: ApplicationCommand) => any
applicationCommandOption: (
bot: Bot<TProps, TBehavior>,
payload: DiscordApplicationCommandOption,
applicationCommandOption: ApplicationCommandOption,
) => any
application: (bot: TBot, payload: DiscordApplication, application: Application) => any
applicationCommand: (bot: TBot, payload: DiscordApplicationCommand, applicationCommand: ApplicationCommand) => any
applicationCommandOption: (bot: TBot, payload: DiscordApplicationCommandOption, applicationCommandOption: ApplicationCommandOption) => any
applicationCommandOptionChoice: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordApplicationCommandOptionChoice,
applicationCommandOptionChoice: ApplicationCommandOptionChoice,
) => any
applicationCommandPermission: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildApplicationCommandPermissions,
applicationCommandPermission: GuildApplicationCommandPermissions,
) => any
attachment: (bot: TBot, payload: DiscordAttachment, attachment: TBot['transformers']['$inferredTypes']['attachment']) => any
auditLogEntry: (bot: TBot, payload: DiscordAuditLogEntry, auditLogEntry: AuditLogEntry) => any
automodActionExecution: (bot: TBot, payload: DiscordAutoModerationActionExecution, automodActionExecution: AutoModerationActionExecution) => any
automodRule: (bot: TBot, payload: DiscordAutoModerationRule, automodRule: AutoModerationRule) => any
attachment: (bot: Bot<TProps, TBehavior>, payload: DiscordAttachment, attachment: SetupDesiredProps<Attachment, TProps, TBehavior>) => any
auditLogEntry: (bot: Bot<TProps, TBehavior>, payload: DiscordAuditLogEntry, auditLogEntry: AuditLogEntry) => any
automodActionExecution: (
bot: Bot<TProps, TBehavior>,
payload: DiscordAutoModerationActionExecution,
automodActionExecution: AutoModerationActionExecution,
) => any
automodRule: (bot: Bot<TProps, TBehavior>, payload: DiscordAutoModerationRule, automodRule: AutoModerationRule) => any
avatarDecorationData: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordAvatarDecorationData,
avatarDecorationData: TBot['transformers']['$inferredTypes']['avatarDecorationData'],
avatarDecorationData: SetupDesiredProps<AvatarDecorationData, TProps, TBehavior>,
) => any
channel: (bot: TBot, payload: DiscordChannel, channel: TBot['transformers']['$inferredTypes']['channel']) => any
component: (bot: TBot, payload: DiscordMessageComponent, component: Component) => any
channel: (bot: Bot<TProps, TBehavior>, payload: DiscordChannel, channel: SetupDesiredProps<Channel, TProps, TBehavior>) => any
component: (bot: Bot<TProps, TBehavior>, payload: DiscordMessageComponent, component: Component) => any
defaultReactionEmoji: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordDefaultReactionEmoji,
defaultReactionEmoji: TBot['transformers']['$inferredTypes']['defaultReactionEmoji'],
defaultReactionEmoji: SetupDesiredProps<DefaultReactionEmoji, TProps, TBehavior>,
) => any
embed: (bot: Bot<TProps, TBehavior>, payload: DiscordEmbed, embed: Embed) => any
emoji: (bot: Bot<TProps, TBehavior>, payload: DiscordEmoji, emoji: SetupDesiredProps<Emoji, TProps, TBehavior>) => any
entitlement: (bot: Bot<TProps, TBehavior>, payload: DiscordEntitlement, entitlement: SetupDesiredProps<Entitlement, TProps, TBehavior>) => any
forumTag: (bot: Bot<TProps, TBehavior>, payload: DiscordForumTag, forumTag: SetupDesiredProps<ForumTag, TProps, TBehavior>) => any
gatewayBot: (bot: Bot<TProps, TBehavior>, payload: DiscordGetGatewayBot, getGatewayBot: GetGatewayBot) => any
guild: (bot: Bot<TProps, TBehavior>, payload: DiscordGuild, guild: SetupDesiredProps<Guild, TProps, TBehavior>) => any
guildOnboarding: (
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildOnboarding,
onboarding: SetupDesiredProps<GuildOnboarding, TProps, TBehavior>,
) => any
embed: (bot: TBot, payload: DiscordEmbed, embed: Embed) => any
emoji: (bot: TBot, payload: DiscordEmoji, emoji: TBot['transformers']['$inferredTypes']['emoji']) => any
entitlement: (bot: TBot, payload: DiscordEntitlement, entitlement: TBot['transformers']['$inferredTypes']['entitlement']) => any
forumTag: (bot: TBot, payload: DiscordForumTag, forumTag: TBot['transformers']['$inferredTypes']['forumTag']) => any
gatewayBot: (bot: TBot, payload: DiscordGetGatewayBot, getGatewayBot: GetGatewayBot) => any
guild: (bot: TBot, payload: DiscordGuild, guild: TBot['transformers']['$inferredTypes']['guild']) => any
guildOnboarding: (bot: TBot, payload: DiscordGuildOnboarding, onboarding: TBot['transformers']['$inferredTypes']['guildOnboarding']) => any
guildOnboardingPrompt: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildOnboardingPrompt,
onboardingPrompt: TBot['transformers']['$inferredTypes']['guildOnboardingPrompt'],
onboardingPrompt: SetupDesiredProps<GuildOnboardingPrompt, TProps, TBehavior>,
) => any
guildOnboardingPromptOption: (bot: TBot, payload: DiscordGuildOnboardingPromptOption, onboardingPromptOption: GuildOnboardingPromptOption) => any
integration: (bot: TBot, payload: DiscordIntegrationCreateUpdate, integration: Integration) => any
guildOnboardingPromptOption: (
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildOnboardingPromptOption,
onboardingPromptOption: GuildOnboardingPromptOption,
) => any
integration: (bot: Bot<TProps, TBehavior>, payload: DiscordIntegrationCreateUpdate, integration: Integration) => any
interaction: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { interaction: DiscordInteraction; shardId: number },
interaction: TBot['transformers']['$inferredTypes']['interaction'],
interaction: SetupDesiredProps<Interaction, TProps, TBehavior>,
) => any
interactionCallback: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordInteractionCallback,
interactionCallback: TBot['transformers']['$inferredTypes']['interactionCallback'],
interactionCallback: SetupDesiredProps<InteractionCallback, TProps, TBehavior>,
) => any
interactionCallbackResponse: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordInteractionCallbackResponse,
interactionCallbackResponse: TBot['transformers']['$inferredTypes']['interactionCallbackResponse'],
interactionCallbackResponse: SetupDesiredProps<InteractionCallbackResponse, TProps, TBehavior>,
) => any
interactionDataOptions: (bot: TBot, payload: DiscordInteractionDataOption, interactionDataOptions: InteractionDataOption) => any
interactionDataOptions: (bot: Bot<TProps, TBehavior>, payload: DiscordInteractionDataOption, interactionDataOptions: InteractionDataOption) => any
interactionDataResolved: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { resolved: DiscordInteractionDataResolved; guildId?: bigint },
interactionDataResolved: InteractionDataResolved,
) => any
interactionResource: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordInteractionResource,
interactionResource: TBot['transformers']['$inferredTypes']['interactionResource'],
interactionResource: SetupDesiredProps<InteractionResource, TProps, TBehavior>,
) => any
invite: (
bot: Bot<TProps, TBehavior>,
payload: DiscordInviteCreate | DiscordInviteMetadata,
invite: SetupDesiredProps<Invite, TProps, TBehavior>,
) => any
invite: (bot: TBot, payload: DiscordInviteCreate | DiscordInviteMetadata, invite: TBot['transformers']['$inferredTypes']['invite']) => any
inviteStageInstance: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordInviteStageInstance,
inviteStageInstance: TBot['transformers']['$inferredTypes']['inviteStageInstance'],
inviteStageInstance: SetupDesiredProps<InviteStageInstance, TProps, TBehavior>,
) => any
member: (bot: TBot, payload: DiscordMember, member: TBot['transformers']['$inferredTypes']['member']) => any
message: (bot: TBot, payload: DiscordMessage, message: TBot['transformers']['$inferredTypes']['message']) => any
messageCall: (bot: TBot, payload: DiscordMessageCall, call: TBot['transformers']['$inferredTypes']['messageCall']) => any
member: (bot: Bot<TProps, TBehavior>, payload: DiscordMember, member: SetupDesiredProps<Member, TProps, TBehavior>) => any
message: (bot: Bot<TProps, TBehavior>, payload: DiscordMessage, message: SetupDesiredProps<Message, TProps, TBehavior>) => any
messageCall: (bot: Bot<TProps, TBehavior>, payload: DiscordMessageCall, call: SetupDesiredProps<MessageCall, TProps, TBehavior>) => any
messageInteractionMetadata: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordMessageInteractionMetadata,
metadata: TBot['transformers']['$inferredTypes']['messageInteractionMetadata'],
metadata: SetupDesiredProps<MessageInteractionMetadata, TProps, TBehavior>,
) => any
messageSnapshot: (
bot: Bot<TProps, TBehavior>,
payload: DiscordMessageSnapshot,
messageSnapshot: SetupDesiredProps<MessageSnapshot, TProps, TBehavior>,
) => any
poll: (bot: Bot<TProps, TBehavior>, payload: DiscordPoll, poll: SetupDesiredProps<Poll, TProps, TBehavior>) => any
pollMedia: (bot: Bot<TProps, TBehavior>, payload: DiscordPollMedia, pollMedia: SetupDesiredProps<PollMedia, TProps, TBehavior>) => any
presence: (bot: Bot<TProps, TBehavior>, payload: DiscordPresenceUpdate, presence: PresenceUpdate) => any
role: (bot: Bot<TProps, TBehavior>, payload: DiscordRole, role: SetupDesiredProps<Role, TProps, TBehavior>) => any
scheduledEvent: (
bot: Bot<TProps, TBehavior>,
payload: DiscordScheduledEvent,
scheduledEvent: SetupDesiredProps<ScheduledEvent, TProps, TBehavior>,
) => any
messageSnapshot: (bot: TBot, payload: DiscordMessageSnapshot, messageSnapshot: TBot['transformers']['$inferredTypes']['messageSnapshot']) => any
poll: (bot: TBot, payload: DiscordPoll, poll: TBot['transformers']['$inferredTypes']['poll']) => any
pollMedia: (bot: TBot, payload: DiscordPollMedia, pollMedia: TBot['transformers']['$inferredTypes']['pollMedia']) => any
presence: (bot: TBot, payload: DiscordPresenceUpdate, presence: PresenceUpdate) => any
role: (bot: TBot, payload: DiscordRole, role: TBot['transformers']['$inferredTypes']['role']) => any
scheduledEvent: (bot: TBot, payload: DiscordScheduledEvent, scheduledEvent: TBot['transformers']['$inferredTypes']['scheduledEvent']) => any
scheduledEventRecurrenceRule: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordScheduledEventRecurrenceRule,
scheduledEvent: TBot['transformers']['$inferredTypes']['scheduledEventRecurrenceRule'],
scheduledEvent: SetupDesiredProps<ScheduledEventRecurrenceRule, TProps, TBehavior>,
) => any
sku: (bot: TBot, payload: DiscordSku, sku: TBot['transformers']['$inferredTypes']['sku']) => any
soundboardSound: (bot: TBot, payload: DiscordSoundboardSound, soundboardSound: TBot['transformers']['$inferredTypes']['soundboardSound']) => any
stageInstance: (bot: TBot, payload: DiscordStageInstance, stageInstance: TBot['transformers']['$inferredTypes']['stageInstance']) => any
sticker: (bot: TBot, payload: DiscordSticker, sticker: TBot['transformers']['$inferredTypes']['sticker']) => any
stickerPack: (bot: TBot, payload: DiscordStickerPack, stickerPack: StickerPack) => any
subscription: (bot: TBot, payload: DiscordSubscription, subscription: TBot['transformers']['$inferredTypes']['subscription']) => any
team: (bot: TBot, payload: DiscordTeam, team: Team) => any
template: (bot: TBot, payload: DiscordTemplate, template: Template) => any
threadMember: (bot: TBot, payload: DiscordThreadMember, threadMember: ThreadMember) => any
threadMemberGuildCreate: (bot: TBot, payload: DiscordThreadMemberGuildCreate, threadMemberGuildCreate: ThreadMemberGuildCreate) => any
user: (bot: TBot, payload: DiscordUser, user: TBot['transformers']['$inferredTypes']['user']) => any
voiceRegion: (bot: TBot, payload: DiscordVoiceRegion, voiceRegion: VoiceRegion) => any
voiceState: (bot: TBot, payload: DiscordVoiceState, voiceState: TBot['transformers']['$inferredTypes']['voiceState']) => any
webhook: (bot: TBot, payload: DiscordWebhook, webhook: TBot['transformers']['$inferredTypes']['webhook']) => any
welcomeScreen: (bot: TBot, payload: DiscordWelcomeScreen, welcomeScreen: WelcomeScreen) => any
widget: (bot: TBot, payload: DiscordGuildWidget, widget: GuildWidget) => any
widgetSettings: (bot: TBot, payload: DiscordGuildWidgetSettings, widgetSettings: GuildWidgetSettings) => any
sku: (bot: Bot<TProps, TBehavior>, payload: DiscordSku, sku: SetupDesiredProps<Sku, TProps, TBehavior>) => any
soundboardSound: (
bot: Bot<TProps, TBehavior>,
payload: DiscordSoundboardSound,
soundboardSound: SetupDesiredProps<SoundboardSound, TProps, TBehavior>,
) => any
stageInstance: (
bot: Bot<TProps, TBehavior>,
payload: DiscordStageInstance,
stageInstance: SetupDesiredProps<StageInstance, TProps, TBehavior>,
) => any
sticker: (bot: Bot<TProps, TBehavior>, payload: DiscordSticker, sticker: SetupDesiredProps<Sticker, TProps, TBehavior>) => any
stickerPack: (bot: Bot<TProps, TBehavior>, payload: DiscordStickerPack, stickerPack: StickerPack) => any
subscription: (bot: Bot<TProps, TBehavior>, payload: DiscordSubscription, subscription: SetupDesiredProps<Subscription, TProps, TBehavior>) => any
team: (bot: Bot<TProps, TBehavior>, payload: DiscordTeam, team: Team) => any
template: (bot: Bot<TProps, TBehavior>, payload: DiscordTemplate, template: Template) => any
threadMember: (bot: Bot<TProps, TBehavior>, payload: DiscordThreadMember, threadMember: ThreadMember) => any
threadMemberGuildCreate: (
bot: Bot<TProps, TBehavior>,
payload: DiscordThreadMemberGuildCreate,
threadMemberGuildCreate: ThreadMemberGuildCreate,
) => any
user: (bot: Bot<TProps, TBehavior>, payload: DiscordUser, user: SetupDesiredProps<User, TProps, TBehavior>) => any
voiceRegion: (bot: Bot<TProps, TBehavior>, payload: DiscordVoiceRegion, voiceRegion: VoiceRegion) => any
voiceState: (bot: Bot<TProps, TBehavior>, payload: DiscordVoiceState, voiceState: SetupDesiredProps<VoiceState, TProps, TBehavior>) => any
webhook: (bot: Bot<TProps, TBehavior>, payload: DiscordWebhook, webhook: SetupDesiredProps<Webhook, TProps, TBehavior>) => any
welcomeScreen: (bot: Bot<TProps, TBehavior>, payload: DiscordWelcomeScreen, welcomeScreen: WelcomeScreen) => any
widget: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildWidget, widget: GuildWidget) => any
widgetSettings: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildWidgetSettings, widgetSettings: GuildWidgetSettings) => any
}
desiredProperties: TransformersDesiredProperties
reverse: {
activity: (bot: TBot, payload: Activity) => DiscordActivity
allowedMentions: (bot: TBot, payload: AllowedMentions) => DiscordAllowedMentions
application: (bot: TBot, payload: Application) => DiscordApplication
applicationCommand: (bot: TBot, payload: ApplicationCommand) => DiscordApplicationCommand
applicationCommandOption: (bot: TBot, payload: ApplicationCommandOption) => DiscordApplicationCommandOption
applicationCommandOptionChoice: (bot: TBot, payload: ApplicationCommandOptionChoice) => DiscordApplicationCommandOptionChoice
attachment: (bot: TBot, payload: TBot['transformers']['$inferredTypes']['attachment']) => DiscordAttachment
component: (bot: TBot, payload: Component) => DiscordMessageComponent
createApplicationCommand: (bot: TBot, payload: CreateApplicationCommand) => DiscordCreateApplicationCommand
embed: (bot: TBot, payload: Embed) => DiscordEmbed
member: (bot: TBot, payload: TBot['transformers']['$inferredTypes']['member']) => DiscordMember
activity: (bot: Bot<TProps, TBehavior>, payload: Activity) => DiscordActivity
allowedMentions: (bot: Bot<TProps, TBehavior>, payload: AllowedMentions) => DiscordAllowedMentions
application: (bot: Bot<TProps, TBehavior>, payload: Application) => DiscordApplication
applicationCommand: (bot: Bot<TProps, TBehavior>, payload: ApplicationCommand) => DiscordApplicationCommand
applicationCommandOption: (bot: Bot<TProps, TBehavior>, payload: ApplicationCommandOption) => DiscordApplicationCommandOption
applicationCommandOptionChoice: (bot: Bot<TProps, TBehavior>, payload: ApplicationCommandOptionChoice) => DiscordApplicationCommandOptionChoice
attachment: (bot: Bot<TProps, TBehavior>, payload: SetupDesiredProps<Attachment, TProps, TBehavior>) => DiscordAttachment
component: (bot: Bot<TProps, TBehavior>, payload: Component) => DiscordMessageComponent
createApplicationCommand: (bot: Bot<TProps, TBehavior>, payload: CreateApplicationCommand) => DiscordCreateApplicationCommand
embed: (bot: Bot<TProps, TBehavior>, payload: Embed) => DiscordEmbed
member: (bot: Bot<TProps, TBehavior>, payload: SetupDesiredProps<Member, TProps, TBehavior>) => DiscordMember
snowflake: (snowflake: BigString) => string
team: (bot: TBot, payload: Team) => DiscordTeam
user: (bot: TBot, payload: TBot['transformers']['$inferredTypes']['user']) => DiscordUser
team: (bot: Bot<TProps, TBehavior>, payload: Team) => DiscordTeam
user: (bot: Bot<TProps, TBehavior>, payload: SetupDesiredProps<User, TProps, TBehavior>) => DiscordUser
}
activity: (bot: TBot, payload: DiscordActivity) => Activity
activityInstance: (bot: TBot, payload: DiscordActivityInstance) => TBot['transformers']['$inferredTypes']['activityInstance']
activityLocation: (bot: TBot, payload: DiscordActivityLocation) => TBot['transformers']['$inferredTypes']['activityLocation']
application: (bot: TBot, payload: { application: DiscordApplication; shardId: number }) => Application
applicationCommand: (bot: TBot, payload: DiscordApplicationCommand) => ApplicationCommand
applicationCommandOption: (bot: TBot, payload: DiscordApplicationCommandOption) => ApplicationCommandOption
applicationCommandOptionChoice: (bot: TBot, payload: DiscordApplicationCommandOptionChoice) => ApplicationCommandOptionChoice
applicationCommandPermission: (bot: TBot, payload: DiscordGuildApplicationCommandPermissions) => GuildApplicationCommandPermissions
attachment: (bot: TBot, payload: DiscordAttachment) => TBot['transformers']['$inferredTypes']['attachment']
auditLogEntry: (bot: TBot, payload: DiscordAuditLogEntry) => AuditLogEntry
automodActionExecution: (bot: TBot, payload: DiscordAutoModerationActionExecution) => AutoModerationActionExecution
automodRule: (bot: TBot, payload: DiscordAutoModerationRule) => AutoModerationRule
avatarDecorationData: (bot: TBot, payload: DiscordAvatarDecorationData) => TBot['transformers']['$inferredTypes']['avatarDecorationData']
channel: (bot: TBot, payload: { channel: DiscordChannel; guildId?: BigString }) => TBot['transformers']['$inferredTypes']['channel']
component: (bot: TBot, payload: DiscordMessageComponent) => Component
defaultReactionEmoji: (bot: TBot, payload: DiscordDefaultReactionEmoji) => TBot['transformers']['$inferredTypes']['defaultReactionEmoji']
embed: (bot: TBot, payload: DiscordEmbed) => Embed
emoji: (bot: TBot, payload: DiscordEmoji) => TBot['transformers']['$inferredTypes']['emoji']
entitlement: (bot: TBot, payload: DiscordEntitlement) => TBot['transformers']['$inferredTypes']['entitlement']
forumTag: (bot: TBot, payload: DiscordForumTag) => TBot['transformers']['$inferredTypes']['forumTag']
gatewayBot: (bot: TBot, payload: DiscordGetGatewayBot) => GetGatewayBot
guild: (bot: TBot, payload: { guild: DiscordGuild; shardId: number }) => TBot['transformers']['$inferredTypes']['guild']
guildOnboarding: (bot: TBot, payload: DiscordGuildOnboarding) => TBot['transformers']['$inferredTypes']['guildOnboarding']
guildOnboardingPrompt: (bot: TBot, payload: DiscordGuildOnboardingPrompt) => TBot['transformers']['$inferredTypes']['guildOnboardingPrompt']
guildOnboardingPromptOption: (bot: TBot, payload: DiscordGuildOnboardingPromptOption) => GuildOnboardingPromptOption
integration: (bot: TBot, payload: DiscordIntegrationCreateUpdate) => Integration
interaction: (bot: TBot, payload: { interaction: DiscordInteraction; shardId: number }) => TBot['transformers']['$inferredTypes']['interaction']
interactionCallback: (bot: TBot, payload: DiscordInteractionCallback) => TBot['transformers']['$inferredTypes']['interactionCallback']
activity: (bot: Bot<TProps, TBehavior>, payload: DiscordActivity) => Activity
activityInstance: (bot: Bot<TProps, TBehavior>, payload: DiscordActivityInstance) => SetupDesiredProps<ActivityInstance, TProps, TBehavior>
activityLocation: (bot: Bot<TProps, TBehavior>, payload: DiscordActivityLocation) => SetupDesiredProps<ActivityLocation, TProps, TBehavior>
application: (bot: Bot<TProps, TBehavior>, payload: { application: DiscordApplication; shardId: number }) => Application
applicationCommand: (bot: Bot<TProps, TBehavior>, payload: DiscordApplicationCommand) => ApplicationCommand
applicationCommandOption: (bot: Bot<TProps, TBehavior>, payload: DiscordApplicationCommandOption) => ApplicationCommandOption
applicationCommandOptionChoice: (bot: Bot<TProps, TBehavior>, payload: DiscordApplicationCommandOptionChoice) => ApplicationCommandOptionChoice
applicationCommandPermission: (
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildApplicationCommandPermissions,
) => GuildApplicationCommandPermissions
attachment: (bot: Bot<TProps, TBehavior>, payload: DiscordAttachment) => SetupDesiredProps<Attachment, TProps, TBehavior>
auditLogEntry: (bot: Bot<TProps, TBehavior>, payload: DiscordAuditLogEntry) => AuditLogEntry
automodActionExecution: (bot: Bot<TProps, TBehavior>, payload: DiscordAutoModerationActionExecution) => AutoModerationActionExecution
automodRule: (bot: Bot<TProps, TBehavior>, payload: DiscordAutoModerationRule) => AutoModerationRule
avatarDecorationData: (
bot: Bot<TProps, TBehavior>,
payload: DiscordAvatarDecorationData,
) => SetupDesiredProps<AvatarDecorationData, TProps, TBehavior>
channel: (bot: Bot<TProps, TBehavior>, payload: { channel: DiscordChannel; guildId?: BigString }) => SetupDesiredProps<Channel, TProps, TBehavior>
component: (bot: Bot<TProps, TBehavior>, payload: DiscordMessageComponent) => Component
defaultReactionEmoji: (
bot: Bot<TProps, TBehavior>,
payload: DiscordDefaultReactionEmoji,
) => SetupDesiredProps<DefaultReactionEmoji, TProps, TBehavior>
embed: (bot: Bot<TProps, TBehavior>, payload: DiscordEmbed) => Embed
emoji: (bot: Bot<TProps, TBehavior>, payload: DiscordEmoji) => SetupDesiredProps<Emoji, TProps, TBehavior>
entitlement: (bot: Bot<TProps, TBehavior>, payload: DiscordEntitlement) => SetupDesiredProps<Entitlement, TProps, TBehavior>
forumTag: (bot: Bot<TProps, TBehavior>, payload: DiscordForumTag) => SetupDesiredProps<ForumTag, TProps, TBehavior>
gatewayBot: (bot: Bot<TProps, TBehavior>, payload: DiscordGetGatewayBot) => GetGatewayBot
guild: (bot: Bot<TProps, TBehavior>, payload: { guild: DiscordGuild; shardId: number }) => SetupDesiredProps<Guild, TProps, TBehavior>
guildOnboarding: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildOnboarding) => SetupDesiredProps<GuildOnboarding, TProps, TBehavior>
guildOnboardingPrompt: (
bot: Bot<TProps, TBehavior>,
payload: DiscordGuildOnboardingPrompt,
) => SetupDesiredProps<GuildOnboardingPrompt, TProps, TBehavior>
guildOnboardingPromptOption: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildOnboardingPromptOption) => GuildOnboardingPromptOption
integration: (bot: Bot<TProps, TBehavior>, payload: DiscordIntegrationCreateUpdate) => Integration
interaction: (
bot: Bot<TProps, TBehavior>,
payload: { interaction: DiscordInteraction; shardId: number },
) => SetupDesiredProps<Interaction, TProps, TBehavior>
interactionCallback: (bot: Bot<TProps, TBehavior>, payload: DiscordInteractionCallback) => SetupDesiredProps<InteractionCallback, TProps, TBehavior>
interactionCallbackResponse: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { interactionCallbackResponse: DiscordInteractionCallbackResponse; shardId: number },
) => TBot['transformers']['$inferredTypes']['interactionCallbackResponse']
interactionDataOptions: (bot: TBot, payload: DiscordInteractionDataOption) => InteractionDataOption
) => SetupDesiredProps<InteractionCallbackResponse, TProps, TBehavior>
interactionDataOptions: (bot: Bot<TProps, TBehavior>, payload: DiscordInteractionDataOption) => InteractionDataOption
interactionDataResolved: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { resolved: DiscordInteractionDataResolved; shardId: number; guildId?: bigint },
) => InteractionDataResolved
interactionResource: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { interactionResource: DiscordInteractionResource; shardId: number },
) => TBot['transformers']['$inferredTypes']['interactionResource']
) => SetupDesiredProps<InteractionResource, TProps, TBehavior>
invite: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { invite: DiscordInviteCreate | DiscordInviteMetadata; shardId: number },
) => TBot['transformers']['$inferredTypes']['invite']
) => SetupDesiredProps<Invite, TProps, TBehavior>
inviteStageInstance: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordInviteStageInstance & { guildId: BigString },
) => TBot['transformers']['$inferredTypes']['inviteStageInstance']
member: (bot: TBot, payload: DiscordMember, guildId: BigString, userId: BigString) => TBot['transformers']['$inferredTypes']['member']
message: (bot: TBot, payload: { message: DiscordMessage; shardId: number }) => TBot['transformers']['$inferredTypes']['message']
messageCall: (bot: TBot, payload: DiscordMessageCall) => TBot['transformers']['$inferredTypes']['messageCall']
) => SetupDesiredProps<InviteStageInstance, TProps, TBehavior>
member: (bot: Bot<TProps, TBehavior>, payload: DiscordMember, guildId: BigString, userId: BigString) => SetupDesiredProps<Member, TProps, TBehavior>
message: (bot: Bot<TProps, TBehavior>, payload: { message: DiscordMessage; shardId: number }) => SetupDesiredProps<Message, TProps, TBehavior>
messageCall: (bot: Bot<TProps, TBehavior>, payload: DiscordMessageCall) => SetupDesiredProps<MessageCall, TProps, TBehavior>
messageInteractionMetadata: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordMessageInteractionMetadata,
) => TBot['transformers']['$inferredTypes']['messageInteractionMetadata']
) => SetupDesiredProps<MessageInteractionMetadata, TProps, TBehavior>
messageSnapshot: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: { messageSnapshot: DiscordMessageSnapshot; shardId: number },
) => TBot['transformers']['$inferredTypes']['messageSnapshot']
poll: (bot: TBot, payload: DiscordPoll) => TBot['transformers']['$inferredTypes']['poll']
pollMedia: (bot: TBot, payload: DiscordPollMedia) => TBot['transformers']['$inferredTypes']['pollMedia']
presence: (bot: TBot, payload: DiscordPresenceUpdate) => PresenceUpdate
role: (bot: TBot, payload: { role: DiscordRole; guildId: BigString }) => TBot['transformers']['$inferredTypes']['role']
scheduledEvent: (bot: TBot, payload: DiscordScheduledEvent) => TBot['transformers']['$inferredTypes']['scheduledEvent']
) => SetupDesiredProps<MessageSnapshot, TProps, TBehavior>
poll: (bot: Bot<TProps, TBehavior>, payload: DiscordPoll) => SetupDesiredProps<Poll, TProps, TBehavior>
pollMedia: (bot: Bot<TProps, TBehavior>, payload: DiscordPollMedia) => SetupDesiredProps<PollMedia, TProps, TBehavior>
presence: (bot: Bot<TProps, TBehavior>, payload: DiscordPresenceUpdate) => PresenceUpdate
role: (bot: Bot<TProps, TBehavior>, payload: { role: DiscordRole; guildId: BigString }) => SetupDesiredProps<Role, TProps, TBehavior>
scheduledEvent: (bot: Bot<TProps, TBehavior>, payload: DiscordScheduledEvent) => SetupDesiredProps<ScheduledEvent, TProps, TBehavior>
scheduledEventRecurrenceRule: (
bot: TBot,
bot: Bot<TProps, TBehavior>,
payload: DiscordScheduledEventRecurrenceRule,
) => TBot['transformers']['$inferredTypes']['scheduledEventRecurrenceRule']
sku: (bot: TBot, payload: DiscordSku) => TBot['transformers']['$inferredTypes']['sku']
soundboardSound: (bot: TBot, payload: DiscordSoundboardSound) => TBot['transformers']['$inferredTypes']['soundboardSound']
) => SetupDesiredProps<ScheduledEventRecurrenceRule, TProps, TBehavior>
sku: (bot: Bot<TProps, TBehavior>, payload: DiscordSku) => SetupDesiredProps<Sku, TProps, TBehavior>
soundboardSound: (bot: Bot<TProps, TBehavior>, payload: DiscordSoundboardSound) => SetupDesiredProps<SoundboardSound, TProps, TBehavior>
snowflake: (snowflake: BigString) => bigint
stageInstance: (bot: TBot, payload: DiscordStageInstance) => TBot['transformers']['$inferredTypes']['stageInstance']
sticker: (bot: TBot, payload: DiscordSticker) => TBot['transformers']['$inferredTypes']['sticker']
stickerPack: (bot: TBot, payload: DiscordStickerPack) => StickerPack
subscription: (bot: TBot, payload: DiscordSubscription) => TBot['transformers']['$inferredTypes']['subscription']
team: (bot: TBot, payload: DiscordTeam) => Team
template: (bot: TBot, payload: DiscordTemplate) => Template
threadMember: (bot: TBot, payload: DiscordThreadMember) => ThreadMember
threadMemberGuildCreate: (bot: TBot, payload: DiscordThreadMemberGuildCreate) => ThreadMemberGuildCreate
user: (bot: TBot, payload: DiscordUser) => TBot['transformers']['$inferredTypes']['user']
voiceRegion: (bot: TBot, payload: DiscordVoiceRegion) => VoiceRegion
voiceState: (bot: TBot, payload: { voiceState: DiscordVoiceState; guildId: BigString }) => TBot['transformers']['$inferredTypes']['voiceState']
webhook: (bot: TBot, payload: DiscordWebhook) => TBot['transformers']['$inferredTypes']['webhook']
welcomeScreen: (bot: TBot, payload: DiscordWelcomeScreen) => WelcomeScreen
widget: (bot: TBot, payload: DiscordGuildWidget) => GuildWidget
widgetSettings: (bot: TBot, payload: DiscordGuildWidgetSettings) => GuildWidgetSettings
stageInstance: (bot: Bot<TProps, TBehavior>, payload: DiscordStageInstance) => SetupDesiredProps<StageInstance, TProps, TBehavior>
sticker: (bot: Bot<TProps, TBehavior>, payload: DiscordSticker) => SetupDesiredProps<Sticker, TProps, TBehavior>
stickerPack: (bot: Bot<TProps, TBehavior>, payload: DiscordStickerPack) => StickerPack
subscription: (bot: Bot<TProps, TBehavior>, payload: DiscordSubscription) => SetupDesiredProps<Subscription, TProps, TBehavior>
team: (bot: Bot<TProps, TBehavior>, payload: DiscordTeam) => Team
template: (bot: Bot<TProps, TBehavior>, payload: DiscordTemplate) => Template
threadMember: (bot: Bot<TProps, TBehavior>, payload: DiscordThreadMember) => ThreadMember
threadMemberGuildCreate: (bot: Bot<TProps, TBehavior>, payload: DiscordThreadMemberGuildCreate) => ThreadMemberGuildCreate
user: (bot: Bot<TProps, TBehavior>, payload: DiscordUser) => SetupDesiredProps<User, TProps, TBehavior>
voiceRegion: (bot: Bot<TProps, TBehavior>, payload: DiscordVoiceRegion) => VoiceRegion
voiceState: (
bot: Bot<TProps, TBehavior>,
payload: { voiceState: DiscordVoiceState; guildId: BigString },
) => SetupDesiredProps<VoiceState, TProps, TBehavior>
webhook: (bot: Bot<TProps, TBehavior>, payload: DiscordWebhook) => SetupDesiredProps<Webhook, TProps, TBehavior>
welcomeScreen: (bot: Bot<TProps, TBehavior>, payload: DiscordWelcomeScreen) => WelcomeScreen
widget: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildWidget) => GuildWidget
widgetSettings: (bot: Bot<TProps, TBehavior>, payload: DiscordGuildWidgetSettings) => GuildWidgetSettings
}
const defaultCustomizer = (_bot: unknown, _payload: unknown, structure: unknown) => structure
+52 -1
View File
@@ -89,7 +89,7 @@ const bot = createBot({
message: {
id: true,
author: true,
}
},
user: {
id: true,
toggles: true, // Toggles includes the "bot" flag
@@ -156,3 +156,54 @@ All the "undesired" properties will be typed with a string that will explain why
The caveats of this behavior are the following:
- Typescript may not always error on the usage of undesired properties, as in some cases, strings can be a valid option (e.g. channel.name is always a string so typescript won't error)
### Removing TypeScript Clutter
Since we dynamically change types based on the desired properties you provide, many functions' types become cluttered. For example, the intellisense for `bot.helpers.getUser()` shows:
```js
(property) getUser: (id: BigString) => Promise<SetupDesiredProps<User, CompleteDesiredProperties<{
message: {
id: true;
author: true;
};
user: {
id: true;
toggles: true;
username: true;
};
}>, DesiredPropertiesBehavior.RemoveKey>>
```
This will become increasingly cluttered as you add more desired properties, making it harder to read and work with. To address this issue, you can do something like:
```js
import { createBot, createDesiredPropertiesObject } from '@discordeno/bot';
const desiredProperties = createDesiredPropertiesObject({
message: {
id: true,
author: true,
},
user: {
id: true,
toggles: true, // Toggles includes the "bot" flag
username: true,
},
})
interface BotDesiredProperties extends Required<typeof desiredProperties> {}
const bot = createBot<BotDesiredProperties>({
// Your usual createBot options, such as token and intents
desiredProperties,
});
```
Now, when you hover over `bot.helpers.getUser()`, you'll see:
```js
(property) getUser: (id: BigString) => Promise<SetupDesiredProps<User, BotDesiredProperties, DesiredPropertiesBehavior.RemoveKey>>
```
This makes it more readable and easier to work with.