FridayNightFunkinBoyfriendBot/commands/urban.js
2024-02-20 16:58:22 +00:00

29 lines
773 B
JavaScript

const urban = require('urban-dictionary')
module.exports = {
name: 'urban',
async execute (context) {
const source = context.source
const args = context.arguments
const cmd = {
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'dark_red', text: 'Urban Cmd'},
]
}
try {
const definitions = await urban.define(args.join(' '))
for (const definition of definitions) {
source.sendFeedback([cmd,{ text: definition.word.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }])
}
} catch (e) {
source.sendFeedback([cmd,{ text: e.toString(), color: 'red' }])
}
}
}