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 { ApplicationCommandOptionTypes, ApplicationCommandTypes, type CreateApplicationCommand } from '@discordeno/types'
import { describe, expect, it, vi } from 'vitest' import { describe, expect, it, vi } from 'vitest'
import type { InteractionData } from '..' import type { InteractionData } from 'discordeno'
import { type ExtractCommands, createCommandHandler } from './command_parser' import { type ExtractCommands, createCommandHandler } from './command_parser'
// Test command definitions // Test command definitions

View File

@ -1,9 +1,9 @@
import { ApplicationCommandOptionTypes } from '@discordeno/types' import { ApplicationCommandOptionTypes } from '@discordeno/types'
import type {CreateApplicationCommand, import type {CreateApplicationCommand,
DiscordInteractionDataOption, DiscordInteractionDataOption,
DiscordInteractionData,
DiscordApplicationCommandOption DiscordApplicationCommandOption
}from '@discordeno/types' }from '@discordeno/types'
import type {InteractionData} from 'discordeno'
import type { SLASH_COMMANDS } from './slash_commands' import type { SLASH_COMMANDS } from './slash_commands'
// Map option types to their TypeScript types // Map option types to their TypeScript types
@ -157,7 +157,7 @@ export function createCommandHandler<T extends readonly CreateApplicationCommand
handler: ExtractCommands<T> handler: ExtractCommands<T>
notFoundHandler: HandlerFunction<{path?: string}> notFoundHandler: HandlerFunction<{path?: string}>
}) { }) {
return async (data: DiscordInteractionData): Promise<void> => { return async (data: InteractionData): Promise<void> => {
if (!data || !data.name) { if (!data || !data.name) {
await notFoundHandler({}) await notFoundHandler({})
return return

View File

@ -1,5 +1,5 @@
import { Client } from '@temporalio/client' import { Client } from '@temporalio/client'
import { ActivityTypes, InteractionTypes } from 'discordeno' import { ActivityTypes, InteractionData, InteractionTypes } from 'discordeno'
import { c } from '#/di' import { c } from '#/di'
import type { BotType } from '#/discord' import type { BotType } from '#/discord'
import { Bot } from '#/discord/bot' import { Bot } from '#/discord/bot'
@ -14,9 +14,14 @@ export const events = () => {
if (interaction.type !== InteractionTypes.ApplicationCommand) { if (interaction.type !== InteractionTypes.ApplicationCommand) {
return return
} }
if (!interaction.data) {
return
}
const temporalClient = await c.getAsync(Client) const temporalClient = await c.getAsync(Client)
let data: Omit<InteractionData, 'resolved'> = interaction.data
// Start the workflow to handle the interaction // Start the workflow to handle the interaction
const handle = await temporalClient.workflow.start(workflowHandleInteractionCreate, { const handle = await temporalClient.workflow.start(workflowHandleInteractionCreate, {
args: [ args: [
@ -27,7 +32,7 @@ export const events = () => {
type: interaction.type, type: interaction.type,
acknowledged: interaction.acknowledged, acknowledged: interaction.acknowledged,
}, },
data: interaction.data, data,
}, },
], ],
workflowId: `discord-interaction-${interaction.id}`, workflowId: `discord-interaction-${interaction.id}`,

View File

@ -1,6 +1,5 @@
import { Intents, type InteractionTypes } from '@discordeno/types' import { Intents, type InteractionTypes } from '@discordeno/types'
import type { DiscordInteractionData} from '@discordeno/types' import type { Bot, CompleteDesiredProperties, DesiredPropertiesBehavior, InteractionData } from 'discordeno'
import type { Bot, CompleteDesiredProperties, DesiredPropertiesBehavior } from 'discordeno'
export const intents = [ export const intents = [
Intents.GuildModeration, Intents.GuildModeration,
Intents.GuildWebhooks, Intents.GuildWebhooks,
@ -60,5 +59,5 @@ export interface InteractionRef {
// Type for the complete interaction handling payload // Type for the complete interaction handling payload
export interface InteractionCreatePayload { export interface InteractionCreatePayload {
ref: InteractionRef ref: InteractionRef
data: DiscordInteractionData data: Omit<InteractionData, 'resolved'>
} }