noot
All checks were successful
commit-tag / commit-tag-image (map[context:./migrations file:./migrations/Dockerfile name:migrations]) (push) Successful in 16s
commit-tag / commit-tag-image (map[context:./ts file:./ts/Dockerfile name:ts]) (push) Successful in 46s

This commit is contained in:
a 2025-06-15 00:10:03 -05:00
parent e55886cd8f
commit 63dabb8466
No known key found for this signature in database
GPG Key ID: 2F22877AA4DFDADB
4 changed files with 16 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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}`,

View File

@ -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'>
}