noot
This commit is contained in:
parent
e55886cd8f
commit
63dabb8466
@ -1,6 +1,6 @@
|
||||
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, type CreateApplicationCommand } from '@discordeno/types'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { InteractionData } from '..'
|
||||
import type { InteractionData } from 'discordeno'
|
||||
import { type ExtractCommands, createCommandHandler } from './command_parser'
|
||||
|
||||
// Test command definitions
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ApplicationCommandOptionTypes } from '@discordeno/types'
|
||||
import type {CreateApplicationCommand,
|
||||
DiscordInteractionDataOption,
|
||||
DiscordInteractionData,
|
||||
DiscordApplicationCommandOption
|
||||
}from '@discordeno/types'
|
||||
import type {InteractionData} from 'discordeno'
|
||||
import type { SLASH_COMMANDS } from './slash_commands'
|
||||
|
||||
// Map option types to their TypeScript types
|
||||
@ -157,7 +157,7 @@ export function createCommandHandler<T extends readonly CreateApplicationCommand
|
||||
handler: ExtractCommands<T>
|
||||
notFoundHandler: HandlerFunction<{path?: string}>
|
||||
}) {
|
||||
return async (data: DiscordInteractionData): Promise<void> => {
|
||||
return async (data: InteractionData): Promise<void> => {
|
||||
if (!data || !data.name) {
|
||||
await notFoundHandler({})
|
||||
return
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Client } from '@temporalio/client'
|
||||
import { ActivityTypes, InteractionTypes } from 'discordeno'
|
||||
import { ActivityTypes, InteractionData, InteractionTypes } from 'discordeno'
|
||||
import { c } from '#/di'
|
||||
import type { BotType } from '#/discord'
|
||||
import { Bot } from '#/discord/bot'
|
||||
@ -14,9 +14,14 @@ export const events = () => {
|
||||
if (interaction.type !== InteractionTypes.ApplicationCommand) {
|
||||
return
|
||||
}
|
||||
if (!interaction.data) {
|
||||
return
|
||||
}
|
||||
|
||||
const temporalClient = await c.getAsync(Client)
|
||||
|
||||
let data: Omit<InteractionData, 'resolved'> = interaction.data
|
||||
|
||||
// Start the workflow to handle the interaction
|
||||
const handle = await temporalClient.workflow.start(workflowHandleInteractionCreate, {
|
||||
args: [
|
||||
@ -27,7 +32,7 @@ export const events = () => {
|
||||
type: interaction.type,
|
||||
acknowledged: interaction.acknowledged,
|
||||
},
|
||||
data: interaction.data,
|
||||
data,
|
||||
},
|
||||
],
|
||||
workflowId: `discord-interaction-${interaction.id}`,
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Intents, type InteractionTypes } from '@discordeno/types'
|
||||
import type { DiscordInteractionData} from '@discordeno/types'
|
||||
import type { Bot, CompleteDesiredProperties, DesiredPropertiesBehavior } from 'discordeno'
|
||||
import type { Bot, CompleteDesiredProperties, DesiredPropertiesBehavior, InteractionData } from 'discordeno'
|
||||
export const intents = [
|
||||
Intents.GuildModeration,
|
||||
Intents.GuildWebhooks,
|
||||
@ -60,5 +59,5 @@ export interface InteractionRef {
|
||||
// Type for the complete interaction handling payload
|
||||
export interface InteractionCreatePayload {
|
||||
ref: InteractionRef
|
||||
data: DiscordInteractionData
|
||||
data: Omit<InteractionData, 'resolved'>
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user