@duxcore/interactive-discord
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -19,18 +19,18 @@ import Discord, { MessageEmbed } from 'discord.js'; | ||
const buttons = new SlashCommand({ name: 'buttons', description: 'Sends various button components', guilds: myGuildId }) | ||
const buttons = new SlashCommand({ name: 'buttons', description: 'Sends various button components' }) | ||
interactiveClient.commands.register(buttons) | ||
const editableButtons = new SlashCommand({ name: 'editable-buttons', description: 'Sends various button components that edit the orignal message', guilds: myGuildId }) | ||
const editableButtons = new SlashCommand({ name: 'editable-buttons', description: 'Sends various button components that edit the orignal message' }) | ||
interactiveClient.commands.register(editableButtons) | ||
const selection = new SlashCommand({ name: 'selection', description: 'Sends basic selection component', guilds: myGuildId }) | ||
const selection = new SlashCommand({ name: 'selection', description: 'Sends basic selection component' }) | ||
interactiveClient.commands.register(selection) | ||
const multiSelect = new SlashCommand({ name: 'multi-select', description: 'Sends multi select component', guilds: myGuildId }) | ||
const multiSelect = new SlashCommand({ name: 'multi-select', description: 'Sends multi select component' }) | ||
interactiveClient.commands.register(multiSelect) | ||
const embed = new SlashCommand({ name: 'embed', description: 'Sends embed with button components', guilds: myGuildId }) | ||
const embed = new SlashCommand({ name: 'embed', description: 'Sends embed with button components' }) | ||
interactiveClient.commands.register(embed) | ||
const emoji = new SlashCommand({ name: 'emoji', description: 'Sends button components with emoji content', guilds: myGuildId }) | ||
const emoji = new SlashCommand({ name: 'emoji', description: 'Sends button components with emoji content' }) | ||
interactiveClient.commands.register(emoji) | ||
@@ -41,3 +41,3 @@ }) | ||
if (!interaction.isHandled) { | ||
switch (interaction.command?.name) { | ||
switch (interaction.raw.data.name) { | ||
case "buttons": | ||
@@ -44,0 +44,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A package that will allow you to seamlessly integrate discord interactions into your bot.", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"license": "GPL-3.0", | ||
@@ -8,0 +8,0 @@ "main": "lib/index", |
import { SlashCommand } from "../structures/SlashCommand"; | ||
import { ApplicationCommand } from "./types/command"; | ||
import { ApplicationCommand, ApplicationCommandOption } from "./types/command"; | ||
@@ -7,3 +7,3 @@ // false - Command has been changed | ||
export function testCommandUnchanged(command: SlashCommand, reference: ApplicationCommand): boolean{ | ||
if (command.name !== reference.name) return false | ||
/* if (command.name !== reference.name) return false | ||
if (command.description !== reference.description) return false | ||
@@ -26,5 +26,13 @@ if (command.options.length !== reference.options?.length) return false | ||
} | ||
} | ||
} */ | ||
const referenceOpts = (reference.options ?? []); | ||
const tests = [ | ||
(command.name == reference.name), | ||
(command.description == reference.description), | ||
(command.options.length == referenceOpts.length) | ||
] | ||
return true | ||
if (tests.includes(false)) return false; | ||
else return true; | ||
} |
97556
1278