Merge pull request #426 from VermiumSifell/dev
🧑💻 Fixed some more code smells
This commit is contained in:
commit
bde5d257ed
3 changed files with 8 additions and 11 deletions
|
@ -1,7 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { BaseInteraction } from "discord.js";
|
import { BaseInteraction } from "discord.js";
|
||||||
|
import { button as CooldownButton } from "../../../../../helpers/cooldown";
|
||||||
import * as cooldown from "../../../../../helpers/cooldown";
|
|
||||||
import deferReply from "../../../../../helpers/deferReply";
|
import deferReply from "../../../../../helpers/deferReply";
|
||||||
|
|
||||||
export default async (interaction: BaseInteraction) => {
|
export default async (interaction: BaseInteraction) => {
|
||||||
|
@ -30,7 +29,7 @@ export default async (interaction: BaseInteraction) => {
|
||||||
if (metadata.dmOnly && guild)
|
if (metadata.dmOnly && guild)
|
||||||
throw new Error("This command is only available in DM");
|
throw new Error("This command is only available in DM");
|
||||||
|
|
||||||
if (metadata.cooldown) await cooldown.button(interaction, metadata.cooldown);
|
if (metadata.cooldown) await CooldownButton(interaction, metadata.cooldown);
|
||||||
|
|
||||||
await currentButton.execute(interaction);
|
await currentButton.execute(interaction);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { ChatInputCommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
import { command as CooldownCommand } from "../../../../../helpers/cooldown";
|
||||||
import * as cooldown from "../../../../../helpers/cooldown";
|
|
||||||
import deferReply from "../../../../../helpers/deferReply";
|
import deferReply from "../../../../../helpers/deferReply";
|
||||||
import getCommandMetadata from "../../../../../helpers/getCommandMetadata";
|
import getCommandMetadata from "../../../../../helpers/getCommandMetadata";
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ export default async (interaction: ChatInputCommandInteraction) => {
|
||||||
throw new Error("This command is only available in DM");
|
throw new Error("This command is only available in DM");
|
||||||
|
|
||||||
if (metadata.cooldown) {
|
if (metadata.cooldown) {
|
||||||
await cooldown.command(interaction, metadata.cooldown);
|
await CooldownCommand(interaction, metadata.cooldown);
|
||||||
}
|
}
|
||||||
await currentCommand.execute(interaction);
|
await currentCommand.execute(interaction);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,18 +4,17 @@ import {
|
||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
InteractionType,
|
InteractionType,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
// Dependencies
|
|
||||||
import * as handlers from "./handlers";
|
|
||||||
|
|
||||||
import { IEventOptions } from "../../../interfaces/EventOptions";
|
import { IEventOptions } from "../../../interfaces/EventOptions";
|
||||||
import logger from "../../../middlewares/logger";
|
import logger from "../../../middlewares/logger";
|
||||||
import audits from "./audits";
|
import audits from "./audits";
|
||||||
|
// Dependencies
|
||||||
|
import { handleCommandInteraction as HandlersHandleCommandInteraction } from "./handlers";
|
||||||
|
|
||||||
export const options: IEventOptions = {
|
export const options: IEventOptions = {
|
||||||
type: "on",
|
type: "on",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Execute the event
|
||||||
export const execute = async (interaction: BaseInteraction) => {
|
export const execute = async (interaction: BaseInteraction) => {
|
||||||
const { guild, id } = interaction;
|
const { guild, id } = interaction;
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ export const execute = async (interaction: BaseInteraction) => {
|
||||||
|
|
||||||
switch (interaction.type) {
|
switch (interaction.type) {
|
||||||
case InteractionType.ApplicationCommand:
|
case InteractionType.ApplicationCommand:
|
||||||
await handlers.handleCommandInteraction(<CommandInteraction>interaction);
|
await HandlersHandleCommandInteraction(<CommandInteraction>interaction);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue