added listPhrases
This commit is contained in:
parent
20cb318b12
commit
d078d12a79
@ -1 +1 @@
|
||||
{"target_phrases":{"idk":"I don't know","hoco":"homecoming","bbl":"be back later","bbg":"baby girl","mb":"my bad","mfw":"my face when","tfw":"that face when","ebr":"East Baton Rouge","ttyl":"talk to you later","ab":"about","w":"with","abt":"about","dk":"don't know","prolly":"probably","tbh":"to be honest","smh":"shaking my head","btw":"by the way","ngl":"not gonna lie","fr":"for real","yessss":"yes","bc":"because","u":"you","thru":"through","lmao":"laughing my ass off","tldr":"too long; didn't read","tl;dr":"too long; didn't read","ofc":"of course","linux":"GNU/Linux","xfl":"Extreme Football League","bi":"bisexual","abbr":"abbreviation","jk":"just kidding","gm":"good morning","mc":"Minecraft"}}
|
||||
{"target_phrases":{"idk":"I don't know","hoco":"homecoming","bbl":"be back later","bbg":"baby girl","mb":"my bad","mfw":"my face when","tfw":"that face when","ebr":"East Baton Rouge","ttyl":"talk to you later","ab":"about","abt":"about","dk":"don't know","prolly":"probably","tbh":"to be honest","smh":"shaking my head","btw":"by the way","ngl":"not gonna lie","fr":"for real","yessss":"yes","bc":"because","u":"you","thru":"through","lmao":"laughing my ass off","tldr":"too long; didn't read","ofc":"of course","linux":"GNU/Linux","xfl":"Extreme Football League","bi":"bisexual","abbr":"abbreviation","jk":"just kidding","gm":"good morning","mc":"Minecraft","nfl":"National Football League","ygd":"you're gonna die","gn":"goodnight"}}
|
14
commands/listPhrases.ts
Normal file
14
commands/listPhrases.ts
Normal file
@ -0,0 +1,14 @@
|
||||
const { codeBlock } = require("discord.js");
|
||||
|
||||
const { SlashCommandBuilder, Discord } = require('discord.js');
|
||||
var abbreviationKey = require("../abbreviation_key.json");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('list_phrases')
|
||||
.setDescription('Lists phrases in target phrases.'),
|
||||
async execute(interaction) {
|
||||
await interaction.reply("Here are the current phrases in the phrase list:" + codeBlock("json", JSON.stringify(abbreviationKey.target_phrases, null, " ")));
|
||||
console.log("User " + interaction.user.tag + " ran /list_phrases");
|
||||
},
|
||||
};
|
@ -6,22 +6,17 @@ console.log(abbreviationKey);
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("add_phrase")
|
||||
.setDescription("adds abbreviation to respond to")
|
||||
.setName("remove_phrase")
|
||||
.setDescription("removes abbreviation")
|
||||
.addStringOption( (option) =>
|
||||
option.setName("abbreviation")
|
||||
.setDescription("The abbreviation to target")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption( option =>
|
||||
option.setName('phrase')
|
||||
.setDescription("The phrase that the abbreviation shortens")
|
||||
.setRequired(true)
|
||||
),
|
||||
async execute(interaction) {
|
||||
var abbreviation = interaction.options.getString('abbreviation').toLowerCase();
|
||||
//var phrase = interaction.options.getString('phrase');
|
||||
await interaction.reply('Removing abbreviation `' + abbreviation + "` from the target list... `");
|
||||
await interaction.reply('Removing abbreviation `' + abbreviation + "` from the target list...");
|
||||
removePhrase(abbreviation);
|
||||
},
|
||||
};
|
||||
@ -38,7 +33,7 @@ function removePhrase(abbrevation) {
|
||||
var jsonPath = path.join(__dirname, '..', 'abbreviation_key.json');
|
||||
fs.unlinkSync(jsonPath);
|
||||
fs.writeFileSync(jsonPath, jsonString, { encoding: 'utf8' }, "\t");
|
||||
console.log("Removed abbreviation from list. JSON now contains:" + abbreviationKey);
|
||||
console.log("Removed abbreviation from list. JSON now contains:" + abbreviationKey.target_phrases);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user