Update commands to slash commands
This commit is contained in:
@@ -1,5 +1,33 @@
|
||||
var libCore = require("../libCore.js");
|
||||
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const log = new DebugBuilder("server", "slang");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('slang')
|
||||
.setDescription('Search Urban Dictionary for a phrase.')
|
||||
.addStringOption(option =>
|
||||
option.setName('phrase')
|
||||
.setDescription('The phrase to search')
|
||||
.setRequired(true)),
|
||||
example: "slang \"[phrase to search]\"",
|
||||
isPrivileged: false,
|
||||
requiresTokens: false,
|
||||
async execute(interaction) {
|
||||
try{
|
||||
var question = encodeURIComponent(interaction.options.getString('phrase').join(" "));
|
||||
|
||||
var slangData = await libCore.getSlang(question);
|
||||
await message.reply(`**Term**: ${decodeURIComponent(question)}\n\n**Answer**: ${slangData.definition}\n\n**Example**: ${slangData.example}`);
|
||||
}catch(err){
|
||||
log.ERROR(err)
|
||||
//await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: 'slang',
|
||||
description: 'Search Urban Dictionary for a phrase.',
|
||||
|
||||
Reference in New Issue
Block a user