mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-24 23:31:05 +01:00
fix: dont run interaction command when there's no run
This commit is contained in:
parent
2a3bf141d9
commit
75003af03c
3 changed files with 5 additions and 5 deletions
|
@ -1,11 +1,11 @@
|
||||||
import { defineCommand } from "../loaders/commands.ts";
|
import { defineCommand } from "../loaders/commands.ts";
|
||||||
import { COMMIT_HASH, PRODUCTION } from "../constants.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({
|
export default defineCommand({
|
||||||
name: "version",
|
name: "version",
|
||||||
options: [],
|
options: [],
|
||||||
run: (context: CommandContext) => {
|
run: (context: InteractionCommandContext) => {
|
||||||
context.interaction.reply({
|
context.interaction.reply({
|
||||||
content: [
|
content: [
|
||||||
`[git-bun-discord-bot-${COMMIT_HASH}](<https://github.com/xHyroM/bun-discord-bot/tree/${COMMIT_HASH}>) ${!PRODUCTION ? "(dev)" : ""}`,
|
`[git-bun-discord-bot-${COMMIT_HASH}](<https://github.com/xHyroM/bun-discord-bot/tree/${COMMIT_HASH}>) ${!PRODUCTION ? "(dev)" : ""}`,
|
||||||
|
|
|
@ -15,7 +15,7 @@ defineListener({
|
||||||
function handleCommand(interaction: ChatInputCommandInteraction) {
|
function handleCommand(interaction: ChatInputCommandInteraction) {
|
||||||
const command = COMMANDS.get(interaction.commandName);
|
const command = COMMANDS.get(interaction.commandName);
|
||||||
|
|
||||||
if (!command) {
|
if (!command || !command.run) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: "Hmm.. Invalid command :P",
|
content: "Hmm.. Invalid command :P",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
|
|
|
@ -11,10 +11,10 @@ interface StringOption extends SlashCommandStringOption {
|
||||||
export interface Command {
|
export interface Command {
|
||||||
name: string;
|
name: string;
|
||||||
options: Option[];
|
options: Option[];
|
||||||
run: (
|
run?: (
|
||||||
context: CommandContext<true>
|
context: CommandContext<true>
|
||||||
) => any;
|
) => any;
|
||||||
runMessage: (
|
runMessage?: (
|
||||||
context: CommandContext<false>
|
context: CommandContext<false>
|
||||||
) => any;
|
) => any;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue