-
-
Save AlexzanderFlores/e6858d89bc491f26eccfd87967a50110 to your computer and use it in GitHub Desktop.
Runtime validation example
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 is written in JS but the handler will still have TS support as expected | |
module.exports = (command, usage, prefix) => { | |
const { guildOnly } = command.commandObject | |
const { guild, message, interaction } = usage | |
if (guildOnly === true && !guild) { | |
const text = 'This command can only be ran within a guild/server.' | |
if (message) message.reply(text) | |
else if (interaction) interaction.reply(text) | |
return false | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment