Merge branch 'master' of ssh://gitea.calebfontenot.com:25566/CCF_100/NoMoreAcronyms

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2023-04-04 17:16:08 -05:00
commit eb4cf4b75f
2 changed files with 19 additions and 3 deletions

View File

@ -7,10 +7,24 @@ module.exports = {
.addStringOption( option => .addStringOption( option =>
option.setName('string') option.setName('string')
.setDescription("String to count characters in") .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) { 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))); await interaction.reply("Input: `" + inputString + "`\n" + "Output: " + codeBlock("", countChars(inputString)));
console.log("User " + interaction.user.tag + " ran /count_chars"); console.log("User " + interaction.user.tag + " ran /count_chars");
}, },

View File

@ -1,4 +1,6 @@
const { REST, Routes } = require('discord.js'); const { REST, Routes } = require('discord.js');
//var guildId = process.argv.slice(1).toString();
//guildId = require('./key.json');
const { clientId, guildId, token } = require('./key.json'); const { clientId, guildId, token } = require('./key.json');
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');