|
|
|
@ -7,10 +7,24 @@ module.exports = {
|
|
|
|
|
.addStringOption( option =>
|
|
|
|
|
option.setName('string')
|
|
|
|
|
.setDescription("String to count characters in")
|
|
|
|
|
.setRequired(true)
|
|
|
|
|
.setRequired(false)
|
|
|
|
|
)
|
|
|
|
|
.addStringOption( option =>
|
|
|
|
|
option.setName('messageid')
|
|
|
|
|
.setDescription("Message ID of message to count characters in")
|
|
|
|
|
.setRequired(false)
|
|
|
|
|
),
|
|
|
|
|
async execute(interaction) {
|
|
|
|
|
var inputString = interaction.options.getString('string');
|
|
|
|
|
var inputString;
|
|
|
|
|
|
|
|
|
|
if (interaction.options.getString('string') !== null) {
|
|
|
|
|
inputString = interaction.options.getString('string');
|
|
|
|
|
} else if (interaction.options.getString('messageid') !== null) {
|
|
|
|
|
var messageId = interaction.options.getString('messageid');
|
|
|
|
|
const messagefromId = await client.channels.cache.get(interaction.channel.id).messages.fetch(messageId);
|
|
|
|
|
inputString = messagefromId.content;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await interaction.reply("Input: `" + inputString + "`\n" + "Output: " + codeBlock("", countChars(inputString)));
|
|
|
|
|
console.log("User " + interaction.user.tag + " ran /count_chars");
|
|
|
|
|
},
|
|
|
|
|