diff --git a/commands/8ball.js b/commands/8ball.js index 4963e24..c69e97b 100644 --- a/commands/8ball.js +++ b/commands/8ball.js @@ -8,16 +8,17 @@ module.exports = { const index = Math.floor(Math.random() * config.answers.length); const answer = config.answers[index] const question = args.slice(0).join(" ") + const avatarURL = message.author.displayAvatarURL() if (!question) { - await message.channel.send(client.generateErrorMessage("You need to ask a question!")); + await message.channel.send(client.generateErrorMessage("You need to ask a question!", avatarURL)); } else { await message.channel.send({embeds: [{ "title": ":8ball: 8Ball", "description": `Your amazing question: **${question}**`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "fields": [ diff --git a/commands/bonk.js b/commands/bonk.js index 510e8b1..287af71 100644 --- a/commands/bonk.js +++ b/commands/bonk.js @@ -1,3 +1,5 @@ +const avatar = require('./avatar'); + module.exports = { name: require('path').parse(__filename).name, @@ -5,16 +7,17 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { await message.channel.send({embeds: [{ "title": " Bonk", "description": `${taggedUser} You have been bonked by ${message.author}!`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/choose.js b/commands/choose.js index f2899b0..4f8f16c 100644 --- a/commands/choose.js +++ b/commands/choose.js @@ -4,12 +4,13 @@ module.exports = { description: "Give some lines of input, and get one back at random", async execute(client, message, _, config) { + const avatarURL = message.author.displayAvatarURL(); var [head, ...options] = message.content.split(/\s*\n\s*/); head = head.slice(this.name.length + config.prefix.length); if (head) options.push(head); if (!options.length) { - await message.channel.send(client.generateErrorMessage("You need to provide some input!")); + await message.channel.send(client.generateErrorMessage("You need to provide some input!", avatarURL)); } else { const answer = options[Math.floor(Math.random() * options.length)]; await message.channel.send({embeds: [{ @@ -17,7 +18,7 @@ module.exports = { "description": answer, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, }]}); diff --git a/commands/cuddle.js b/commands/cuddle.js index c5b2a84..bd237aa 100644 --- a/commands/cuddle.js +++ b/commands/cuddle.js @@ -14,16 +14,17 @@ module.exports = { const taggedUser = message.mentions.users.first(); const index = Math.floor(Math.random() * gifchoices.length); const gif = (gifchoices[index]); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { await message.channel.send({embeds: [{ "title": ":heart: Cuddle", "description": `${taggedUser} You have been cuddled by ${message.author}!`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/hug.js b/commands/hug.js index 12ea199..9a747a5 100644 --- a/commands/hug.js +++ b/commands/hug.js @@ -13,9 +13,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -23,7 +24,7 @@ module.exports = { "description": `${taggedUser} You have been hugged by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/kiss.js b/commands/kiss.js index eb42134..1159efe 100644 --- a/commands/kiss.js +++ b/commands/kiss.js @@ -13,9 +13,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -23,7 +24,7 @@ module.exports = { "description": `${taggedUser} You have been kissed by ${message.author}!`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/leskiss.js b/commands/leskiss.js index e635a2c..dcc64d5 100644 --- a/commands/leskiss.js +++ b/commands/leskiss.js @@ -23,9 +23,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -33,7 +34,7 @@ module.exports = { "description": `${taggedUser} You have been kissed by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/lick.js b/commands/lick.js index 6748348..e3730ea 100644 --- a/commands/lick.js +++ b/commands/lick.js @@ -12,9 +12,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -22,7 +23,7 @@ module.exports = { "description": `${taggedUser} You have been licked by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/nom.js b/commands/nom.js index 9397295..8f6132e 100644 --- a/commands/nom.js +++ b/commands/nom.js @@ -11,10 +11,11 @@ module.exports = { description: "Noms an user!", async execute(client, message, _, config) { - const taggedUser = message.mentions.users.first(); + const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -22,7 +23,7 @@ module.exports = { "description": `${taggedUser} You have been nommed by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/pat.js b/commands/pat.js index 243afa1..ce3d613 100644 --- a/commands/pat.js +++ b/commands/pat.js @@ -11,9 +11,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -21,7 +22,7 @@ module.exports = { "description": `${taggedUser} You have been patted by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/poke.js b/commands/poke.js index 9fbcc91..ff2aa25 100644 --- a/commands/poke.js +++ b/commands/poke.js @@ -11,9 +11,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -21,7 +22,7 @@ module.exports = { "description": `${taggedUser} You have been poked by ${message.author}!`, "color": 8311585, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/reload.js b/commands/reload.js index 95ec266..3101a4c 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -4,9 +4,10 @@ module.exports = { description: 'Reloads a command', async execute(client, message, args, config) { + const avatarURL = message.author.displayAvatarURL(); if (message.author.id = config.ownerID) { if (!args.length) { - await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock",message.author.displayAvatarURL())); + await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock", avatarURL)); } args.forEach(async (arg) => { const commandName = arg.toLowerCase(); @@ -14,7 +15,7 @@ module.exports = { || message.client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); if (!command) { - await message.channel.send(client.generateErrorMessage(`There is no command with name or alias \`${commandName}\`, ${message.author}!`,message.author.displayAvatarURL())); + await message.channel.send(client.generateErrorMessage(`There is no command with name or alias \`${commandName}\`, ${message.author}!`, avatarURL)); } else { delete require.cache[require.resolve(`./${command.name}.js`)]; @@ -25,7 +26,7 @@ module.exports = { console.log(`User reloaded ${command.name}.`) } catch (error) { console.error(error); - await message.channel.send(client.generateErrorMessage(`There was an error while reloading \`${command.name}\`:\n\`${error.message}\``, message.author.displayAvatarURL())); + await message.channel.send(client.generateErrorMessage(`There was an error while reloading \`${command.name}\`:\n\`${error.message}\``, avatarURL)); } } }); @@ -35,7 +36,7 @@ module.exports = { "title": "<:AnitroxDenied:809651936642203668> **403 Forbidden**", "color": 13632027, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "fields": [ diff --git a/commands/setnick.js b/commands/setnick.js index 69e8ffa..f7e4939 100644 --- a/commands/setnick.js +++ b/commands/setnick.js @@ -4,6 +4,8 @@ module.exports = { description: 'Sets your nickname', async execute(client, message, args, config) { + const avatarURL = message.author.displayAvatarURL(); + if (message.channel.permissionsFor(message.author).has("CHANGE_NICKNAME")) { const newnick = args.slice(0).join(" ") try { @@ -28,10 +30,10 @@ module.exports = { ] }]}); } catch (error) { - await message.channel.send(client.generateErrorMessage("Failed to set user nickname. Does the bot have the correct permissions?", message.author.displayAvatarURL())); + await message.channel.send(client.generateErrorMessage("Failed to set user nickname. Does the bot have the correct permissions?", avatarURL)); }; } else { - await message.channel.send(client.generateErrorMessage("You need to have permission ``CHANGE_NICKNAME`` to change your nick!", message.author.displayAvatarURL())); + await message.channel.send(client.generateErrorMessage("You need to have permission ``CHANGE_NICKNAME`` to change your nick!", avatarURL)); } } } diff --git a/commands/slap.js b/commands/slap.js index e39f9b1..1b31afd 100644 --- a/commands/slap.js +++ b/commands/slap.js @@ -5,16 +5,17 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { await message.channel.send({embeds: [{ "title": ":anger: Slap", "description": `${taggedUser} You have been slapped by ${message.author}!`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/commands/snuggle.js b/commands/snuggle.js index 3d628eb..0020797 100644 --- a/commands/snuggle.js +++ b/commands/snuggle.js @@ -12,9 +12,10 @@ module.exports = { async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); + const avatarURL = message.author.displayAvatarURL(); if(!taggedUser) { - await message.channel.send(client.generateErrorMessage("You need to @mention a user!")); + await message.channel.send(client.generateErrorMessage("You need to @mention a user!", avatarURL)); } else { const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)]; await message.channel.send({embeds: [{ @@ -22,7 +23,7 @@ module.exports = { "description": `${taggedUser} You have been snuggled by ${message.author}!`, "color": 9442302, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "image": { diff --git a/start.js b/start.js index 2f616bf..e9b9a65 100755 --- a/start.js +++ b/start.js @@ -14,11 +14,11 @@ for (const file of commandFiles) { client.commands.set(command.name, command); } -client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embeds: [{ +client.generateErrorMessage = (errorMsg, avatarURL) => ({embeds: [{ "title": "<:AnitroxError:809651936563429416> Error", "color": 13632027, "footer": { - "icon_url": message.author.displayAvatarURL(), + "icon_url": avatarURL, "text": config.footerTxt }, "fields": [