Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattythedev01 committed Oct 15, 2024
1 parent 7b64c7c commit d852d95
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/events/ready/tos.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,25 @@ module.exports = async (client) => {

// If TosAgreement is true, allow the command to proceed
try {
if (!client.commands) {
console.error("client.commands is undefined");
await interaction.reply({
content:
"There was an error while executing this command. The bot is not fully initialized.",
ephemeral: true,
});
return;
}

const command = client.commands.get(interaction.commandName);
if (!command) return;
if (!command) {
console.error(`Command not found: ${interaction.commandName}`);
await interaction.reply({
content: "This command doesn't exist.",
ephemeral: true,
});
return;
}
await command.run(client, interaction);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit d852d95

Please sign in to comment.