Skip to content

Commit b3a5a9c

Browse files
committed
refactor: update import paths to use relative paths
1 parent 7ac3fb0 commit b3a5a9c

File tree

12 files changed

+29
-27
lines changed

12 files changed

+29
-27
lines changed

src/runtime/client/pages/slash-commands.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import type { WatchEvent } from 'nuxt/schema'
3-
import type { SlashCommand, SlashCommandOption } from '~/src/types'
3+
import type { SlashCommand, SlashCommandOption } from '../../../types'
44
import { computed, ref, useFetch, useRuntimeConfig, watchEffect } from '#imports'
55
import { useWebSocket } from '@vueuse/core'
66
import slashCommands from 'discord/slashCommands'
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { defineEventHandler, useDiscordClient } from '#imports'
1+
import { defineEventHandler } from 'h3'
2+
import { useDiscordClient } from '../../../utils/useDiscordClient'
23

34
export default defineEventHandler(async () => {
45
const client = useDiscordClient()
56
const commands = client.getSlashCommands()
67

78
return {
8-
commands: commands.map(({ execute, load, ...command }) => command),
9+
commands,
910
}
1011
})

src/runtime/server/api/discord/slash-command/register.post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useDiscordClient } from '#imports'
21
import { defineEventHandler } from 'h3'
2+
import { useDiscordClient } from '../../../utils/useDiscordClient'
33

44
export default defineEventHandler(async () => {
55
const client = useDiscordClient()

src/runtime/server/api/discord/slash-command/remote-all.get.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineEventHandler, useDiscordClient } from '#imports'
1+
import { defineEventHandler } from 'h3'
2+
import { useDiscordClient } from '../../../utils/useDiscordClient'
23

34
export default defineEventHandler(async () => {
45
const client = useDiscordClient()

src/runtime/server/api/discord/slash-command/remote-diff.post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { APIApplicationCommand } from 'discord.js'
2-
import type { SlashCommand, SlashCommandRuntime } from '~/src/types'
3-
import { useDiscordClient } from '#imports'
2+
import type { SlashCommand, SlashCommandRuntime } from '../../../../../types'
43
import { defineEventHandler, readBody } from 'h3'
4+
import { useDiscordClient } from '../../../utils/useDiscordClient'
55

66
export default defineEventHandler<{
77
body?: {

src/runtime/server/plugins/discord.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WatchEvent } from 'nuxt/schema'
2-
import type { SlashCommand, SlashCommandRuntime } from '~/src/types'
2+
import type { SlashCommand, SlashCommandRuntime } from '../../../types'
33
import fs from 'node:fs'
44
import slashCommands from 'discord/slashCommands'
55
import { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime'

src/runtime/server/utils/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { APIApplicationCommand, APIApplicationCommandOption, ChatInputCommandInteraction, RESTGetAPIApplicationCommandsResult, RESTPatchAPIApplicationCommandResult, RESTPutAPIApplicationCommandsResult } from 'discord.js'
2-
import type { NuxtDiscordOptions, SlashCommandOption, SlashCommandOptionType, SlashCommandReturnType, SlashCommandRuntime } from '~/src/types'
2+
import type { NuxtDiscordOptions, SlashCommandOption, SlashCommandOptionType, SlashCommandReturnType, SlashCommandRuntime } from '../../../types'
33
import process from 'node:process'
44
import { ApplicationCommandOptionType, Events, Client as InternalClient, REST, Routes, SlashCommandBuilder } from 'discord.js'
55
import { useNitroApp } from 'nitropack/runtime'
@@ -478,7 +478,6 @@ export class DiscordClient {
478478
this.#nitro.hooks.callHook('discord:client:error', {
479479
type: 'SlashCommandRegistrationError',
480480
client: this,
481-
interaction: currentInteraction!,
482481
command: result.reason.command,
483482
error: result.reason.error,
484483
})
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import type { SlashCommandOptionType, SlashCommandReturnType } from '~/src/types'
1+
import type { SlashCommandOptionType, SlashCommandReturnType } from '../../../types'
22

33
/**
44
* Defines a slash command function that is automatically registered
55
* by the Nuxt Discord module.
66
*
77
* @param command - The function that implements the slash command.
88
*/
9-
export function defineSlashCommand(
10-
// weird workaround for typescript to not yell at me
11-
command: {
12-
// eslint-disable-next-line ts/method-signature-style
13-
exec(...args: (SlashCommandOptionType | undefined)[]): SlashCommandReturnType
14-
}['exec'],
9+
export function defineSlashCommand<Args extends (SlashCommandOptionType | undefined)[]>(
10+
command: (...args: Args) => SlashCommandReturnType,
1511
) {
1612
return command
1713
}

src/runtime/server/utils/describeOption.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { APIApplicationCommandOptionChoice } from 'discord.js'
2-
import type { SlashCommandOptionType } from '~/src/types'
2+
import type { SlashCommandOptionType } from '../../../types'
33

44
export interface DescribeOptionOptionsBase {
55
/** The name of the command. */

src/runtime/server/utils/useDiscordClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { DiscordClient } from '#imports'
1+
import type { DiscordClient } from './client'
22
import { createError } from 'h3'
33

44
/**

0 commit comments

Comments
 (0)