-
Notifications
You must be signed in to change notification settings - Fork 59
/
rhyme.js
62 lines (50 loc) · 1.8 KB
/
rhyme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const {
MessageEmbed
} = require('discord.js')
const rhyme = require('rhyme')
const colors = require('../lib/colors.json')
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
const language = client.getSettings(message.guild.id).language
const lang = require("../lib/languages/" + language + ".json")
try {
if (!args[0]) return message.channel.send(lang.NoArgumentSpecified)
let embed = new MessageEmbed()
.setColor(colors.default)
.setDescription(lang.FindingRhymes)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()
const msg = await message.channel.send({
embeds: [embed]
})
rhyme(async (rl) => {
let rhymes = ''
const words = rl.rhyme(args.join(' '))
words.forEach(word => {
rhymes += word.toProperCase() + ', '
})
rhymes = rhymes.slice(0, -2)
embed = new MessageEmbed()
.setTitle(`${args[0]}`)
.setColor(colors.default)
.setDescription(`${rhymes || lang.NoRhymes}`)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()
msg.edit(embed)
})
} catch (err) {
const errors = require('../modules/errors.js')
errors.embedError(err, lang, message)
}
}
exports.conf = {
enabled: true,
aliases: ['ryme', 'rhime', 'rime', 'rhymes'], // Since people can't spell...
guildOnly: false,
permLevel: 'User'
}
exports.help = {
name: 'rhyme',
category: 'Fun',
description: 'Shows all of the words that rhyme with <word>.',
usage: 'rhyme <word>'
}