-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor all code and update everything to the latest template (#351)
* Delete the package-lock.json file and reinstall. * Delete all the old files from the src folder and create new ones. * Add the initial code to run the bot in the index file. * Add the events/ready section and implement a new loadEvents method that is more modern and efficient by switching to ESM. * Apply the changes in the index.js and test them. * Change from loading as interactionCreate in loadEvents and add a check. * Add command loading and add interaction handling for each command properly. * Update version to 2.0.0 from the old 1.0.0 * Update SECURITY.md
- Loading branch information
1 parent
768d26b
commit 180ace3
Showing
15 changed files
with
191 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import { SlashCommandBuilder } from '@discordjs/builders'; | ||
import { SlashCommandBuilder } from 'discord.js'; | ||
|
||
export const ping = { | ||
export default { | ||
data: new SlashCommandBuilder() | ||
.setName('ping') | ||
.setDescription('Replies with Pong!'), | ||
async execute(interaction) { | ||
await interaction.reply('Pong!!!!'); | ||
await interaction.reply('Pong!'); | ||
} | ||
}; | ||
|
||
export default ping; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default { | ||
once: false, | ||
async execute(interaction) { | ||
if (!interaction.isCommand()) return; | ||
|
||
const command = interaction.client.commands.get(interaction.commandName); | ||
|
||
if (!command) { | ||
console.warn(`⚠️ Command not found: ${interaction.commandName}`); | ||
return; | ||
} | ||
|
||
try { | ||
await command.execute(interaction); | ||
} catch (error) { | ||
console.error(`❌ Error executing command: ${error.message}`); | ||
await interaction.reply({ content: 'There was an error executing this command!', ephemeral: true }); | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
import chalk from 'chalk'; | ||
|
||
export const ready = { | ||
name: 'ready', | ||
export default { | ||
once: true, | ||
execute(client) { | ||
console.log( | ||
chalk.bgBlueBright.black( | ||
` Successfully logged in as: ${client.user.tag} ` | ||
) | ||
); | ||
console.log(`Logged in as ${client.user.tag}`); | ||
} | ||
}; | ||
|
||
export default ready; |
Oops, something went wrong.