fix: dont run interaction command when there's no run

This commit is contained in:
Jozef Steinhübl 2023-08-24 10:24:31 +02:00
parent 2a3bf141d9
commit 75003af03c
3 changed files with 5 additions and 5 deletions

View file

@ -1,11 +1,11 @@
import { defineCommand } from "../loaders/commands.ts";
import { COMMIT_HASH, PRODUCTION } from "../constants.ts";
import { CommandContext } from "../structs/context/CommandContext.ts";
import { InteractionCommandContext } from "../structs/context/CommandContext.ts";
export default defineCommand({
name: "version",
options: [],
run: (context: CommandContext) => {
run: (context: InteractionCommandContext) => {
context.interaction.reply({
content: [
`[git-bun-discord-bot-${COMMIT_HASH}](<https://github.com/xHyroM/bun-discord-bot/tree/${COMMIT_HASH}>) ${!PRODUCTION ? "(dev)" : ""}`,

View file

@ -15,7 +15,7 @@ defineListener({
function handleCommand(interaction: ChatInputCommandInteraction) {
const command = COMMANDS.get(interaction.commandName);
if (!command) {
if (!command || !command.run) {
interaction.reply({
content: "Hmm.. Invalid command :P",
ephemeral: true,

View file

@ -11,10 +11,10 @@ interface StringOption extends SlashCommandStringOption {
export interface Command {
name: string;
options: Option[];
run: (
run?: (
context: CommandContext<true>
) => any;
runMessage: (
runMessage?: (
context: CommandContext<false>
) => any;
}