woomy/commands/pride.js

51 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-04-20 04:52:50 +00:00
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
2020-04-20 03:02:10 +00:00
2020-04-11 09:30:51 +00:00
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
2020-04-11 09:30:51 +00:00
permLevel: 'User',
requiredPerms: ['ATTACH_FILES'],
cooldown: 15000
}
exports.help = {
name: 'pride',
category: 'Fun',
2020-04-24 07:50:54 +00:00
description: 'Adds a pride flag ring to your avatar. Available flags are lesbian, gay, bisexual, pansexual, trans, asexual, aromantic and ally.',
2020-04-11 09:30:51 +00:00
usage: '`pride [flag]` - Adds a pride flag overlay to your avatar.\n`pride -g [flag]` - Adds a pride flag gradient on your avatar.',
parameters: '`flag` - What flag you want to add to your avatar (options listed above)\n`-g` - Add this to the start of the command to turn the flag into a gradient.'
}
2020-04-10 02:57:04 +00:00
const url = 'https://demirramon.com/gen/pride.png'
const Discord = require('discord.js')
exports.run = (client, message, args) => {
2020-04-11 09:30:51 +00:00
const flag = args[0]
2020-04-10 02:57:04 +00:00
if (!flag) {
return client.userError(message, exports, 'Missing argument, the `flag` argument is required!')
2020-04-10 02:57:04 +00:00
}
const available = ['lesbian', 'gay', 'bisexual', 'pansexual', 'trans', 'asexual', 'aromantic', 'ally']
2020-04-11 09:30:51 +00:00
if (!available.includes(flag.toLowerCase())) {
return message.channel.send(`This flag isn't available, sorry ;~;\nAvailable flags: \`${available.join('`, `')}\``)
2020-04-10 02:57:04 +00:00
}
let gradient = 'false'
if (message.flags.includes('g')) {
gradient = 'true'
}
message.channel.startTyping()
2020-04-11 09:30:51 +00:00
const params = `image=${message.author.avatarURL({ format: 'png', size: 2048 })}&flag=${flag.toLowerCase()}&full=true&gradient=${gradient}&background=false&fit=true&v=2019-08-07`
2020-04-10 02:57:04 +00:00
try {
message.channel.stopTyping()
message.channel.send({ files: [new Discord.MessageAttachment(url + '?' + params)] })
} catch (err) {
message.channel.stopTyping()
message.channel.send(`<:error:466995152976871434> Error when generating image: \`${err}\``)
}
}