Skip to content

Commit 03395fb

Browse files
committed
Remove unused discord command logic
1 parent 09816f8 commit 03395fb

File tree

3 files changed

+1
-66
lines changed

3 files changed

+1
-66
lines changed

src/clients/discord.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
import { Client, Events, SlashCommandBuilder, Interaction, CommandInteraction, REST, Routes, InteractionType, ApplicationCommandType } from "discord.js";
2-
3-
export interface Command {
4-
info: SlashCommandBuilder,
5-
execute: (interaction: CommandInteraction) => Promise<void>;
6-
}
1+
import { Client } from "discord.js";
72

83
export interface IClient extends Client {
9-
commands: Map<string, Command>;
10-
addCommand: (command: Command) => void;
11-
saveCommands: () => Promise<void>;
124
/*
135
* Waits for client to be ready, if it is already ready it will immidiately resolve
146
*/
@@ -19,41 +11,9 @@ const client = new Client({
1911
intents: ["DirectMessages"],
2012
}) as IClient;
2113

22-
const rest = new REST({ version: "10" });
23-
24-
client.commands = new Map<string, Command>();
25-
client.addCommand = (command: Command) => {
26-
client.commands.set(command.info.name, command);
27-
};
28-
client.saveCommands = async () => {
29-
const commands = [];
30-
for (const [_, command] of client.commands.entries()) {
31-
commands.push(command.info.toJSON());
32-
}
33-
await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_APPLICATION_ID!, process.env.DISCORD_GUILD_ID!), {
34-
body: commands
35-
});
36-
};
37-
38-
rest.setToken(process.env.DISCORD_TOKEN!);
3914
client.login(process.env.DISCORD_TOKEN);
4015
client.user?.setStatus("online");
4116

42-
client.on("interactionCreateHook", (interaction: Interaction) => {
43-
if (!interaction.isChatInputCommand()) return;
44-
45-
const command = client.commands.get(interaction.commandName);
46-
if (!command) {
47-
interaction.reply({
48-
content: "Command does not exist",
49-
ephemeral: true
50-
});
51-
return;
52-
};
53-
54-
command.execute(interaction);
55-
});
56-
5717
client.awaitReady = async function () {
5818
const isReady = this.isReady();
5919
if (isReady) return;

src/commands/email.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/commands/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)