From f59826f7ab25dcb29c3d409a14d5775ff4c7e2b7 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 7 Apr 2024 19:06:19 -0400 Subject: [PATCH] Discord.js v14 --- Xiao.js | 52 ++++++------- assets/json/activity.json | 54 -------------- commands/analyze/screenshot.js | 3 +- commands/edit-avatar/avatar-fusion.js | 7 +- commands/edit-avatar/eject.js | 5 +- commands/edit-avatar/fire.js | 5 +- commands/edit-avatar/hat.js | 5 +- commands/edit-avatar/he-lives-in-you.js | 5 +- commands/edit-avatar/hearts.js | 5 +- commands/edit-avatar/i-have-the-power.js | 5 +- commands/edit-avatar/rip.js | 5 +- commands/edit-avatar/status-button.js | 3 +- commands/edit-avatar/steam-now-playing.js | 5 +- commands/edit-avatar/triggered.js | 5 +- commands/edit-image-text/ace-attorney.js | 3 +- commands/edit-image-text/achievement.js | 3 +- commands/edit-image-text/axis-cult-sign-up.js | 3 +- commands/edit-image-text/caution.js | 3 +- commands/edit-image-text/certificate.js | 3 +- .../edit-image-text/chinese-restaurant.js | 3 +- commands/edit-image-text/danger.js | 3 +- commands/edit-image-text/gandhi-quote.js | 3 +- commands/edit-image-text/highway-sign.js | 3 +- commands/edit-image-text/hollywood-star.js | 3 +- commands/edit-image-text/jeopardy-question.js | 3 +- commands/edit-image-text/license-plate.js | 3 +- commands/edit-image-text/speed-limit.js | 3 +- .../edit-image-text/spongebob-time-card.js | 3 +- commands/edit-image-text/tweet.js | 5 +- commands/edit-image-text/undertale.js | 3 +- commands/edit-image-text/zero-dialogue.js | 3 +- commands/edit-image/approved.js | 5 +- commands/edit-image/ascii.js | 2 +- commands/edit-image/blur.js | 5 +- commands/edit-image/bob-ross.js | 5 +- commands/edit-image/brazzers.js | 5 +- commands/edit-image/charcoal.js | 5 +- commands/edit-image/chocolate-milk.js | 5 +- commands/edit-image/circle.js | 5 +- commands/edit-image/color.js | 3 +- commands/edit-image/communist.js | 5 +- commands/edit-image/contrast.js | 5 +- commands/edit-image/convert-image.js | 3 +- commands/edit-image/desaturate.js | 5 +- commands/edit-image/dexter.js | 5 +- commands/edit-image/distort.js | 5 +- commands/edit-image/emboss.js | 5 +- commands/edit-image/fire-frame.js | 5 +- commands/edit-image/fish-eye.js | 5 +- commands/edit-image/frame.js | 5 +- commands/edit-image/ghost.js | 5 +- commands/edit-image/glass-shatter.js | 5 +- commands/edit-image/glitch.js | 5 +- commands/edit-image/greyscale.js | 5 +- commands/edit-image/gun.js | 5 +- commands/edit-image/hands.js | 5 +- commands/edit-image/ifunny.js | 5 +- commands/edit-image/implode.js | 5 +- commands/edit-image/invert.js | 5 +- commands/edit-image/lego-icon.js | 5 +- commands/edit-image/liquid-rescale.js | 5 +- commands/edit-image/mirror.js | 5 +- commands/edit-image/motion-blur.js | 5 +- commands/edit-image/needs-more-jpeg.js | 5 +- commands/edit-image/noise.js | 5 +- commands/edit-image/oil-painting.js | 5 +- commands/edit-image/pet.js | 5 +- commands/edit-image/pixelize.js | 5 +- commands/edit-image/pokemon-fusion.js | 3 +- commands/edit-image/police-tape.js | 5 +- commands/edit-image/rainbow.js | 5 +- commands/edit-image/rejected.js | 5 +- commands/edit-image/resize.js | 5 +- commands/edit-image/rotate.js | 5 +- commands/edit-image/sepia.js | 5 +- commands/edit-image/shake.js | 5 +- commands/edit-image/silhouette.js | 5 +- commands/edit-image/sip.js | 5 +- commands/edit-image/sketch.js | 5 +- commands/edit-image/snapchat.js | 5 +- commands/edit-image/spotify-now-playing.js | 5 +- commands/edit-image/square.js | 5 +- commands/edit-image/squish.js | 5 +- commands/edit-image/steam-card.js | 5 +- commands/edit-image/subtitle.js | 5 +- commands/edit-image/swirl.js | 5 +- commands/edit-image/tint.js | 5 +- commands/edit-image/vignette.js | 5 +- commands/edit-image/wanted.js | 5 +- commands/edit-image/wild-pokemon.js | 5 +- commands/edit-image/you-died.js | 5 +- commands/edit-image/yu-gi-oh-gen.js | 5 +- commands/edit-meme/3000-years.js | 5 +- commands/edit-meme/alert.js | 3 +- commands/edit-meme/bart-chalkboard.js | 3 +- commands/edit-meme/be-like-bill.js | 3 +- commands/edit-meme/beautiful.js | 5 +- commands/edit-meme/boardroom-meeting.js | 3 +- commands/edit-meme/bottom-text.js | 5 +- commands/edit-meme/catch.js | 3 +- commands/edit-meme/challenger.js | 5 +- commands/edit-meme/change-my-mind.js | 3 +- commands/edit-meme/chi-idea.js | 3 +- commands/edit-meme/crush.js | 5 +- commands/edit-meme/cursed-sponge.js | 3 +- commands/edit-meme/dear-liberals.js | 3 +- commands/edit-meme/deep-fry.js | 5 +- commands/edit-meme/demotivational.js | 5 +- commands/edit-meme/dislike.js | 5 +- commands/edit-meme/distracted-boyfriend.js | 9 ++- commands/edit-meme/drakeposting.js | 3 +- commands/edit-meme/edd-facts-book.js | 3 +- commands/edit-meme/enslaved.js | 5 +- commands/edit-meme/food-broke.js | 5 +- commands/edit-meme/for-five-hours.js | 5 +- commands/edit-meme/genie-rules.js | 3 +- commands/edit-meme/girl-worth-fighting-for.js | 5 +- commands/edit-meme/gru-plan.js | 3 +- commands/edit-meme/i-cant-believe.js | 3 +- commands/edit-meme/i-fear-no-man.js | 5 +- .../edit-meme/if-those-kids-could-read.js | 3 +- commands/edit-meme/kyon-gun.js | 5 +- commands/edit-meme/like.js | 5 +- commands/edit-meme/lisa-presentation.js | 3 +- commands/edit-meme/look-at-this-photograph.js | 5 +- commands/edit-meme/look-what-karen-have.js | 5 +- commands/edit-meme/mario-bros-views.js | 3 +- commands/edit-meme/meme-gen.js | 5 +- commands/edit-meme/metamorphosis.js | 5 +- commands/edit-meme/my-collection-grows.js | 5 +- commands/edit-meme/new-password.js | 3 +- commands/edit-meme/nike-ad.js | 5 +- commands/edit-meme/panik-kalm-panik.js | 3 +- commands/edit-meme/phoebe-teaching-joey.js | 3 +- commands/edit-meme/pills.js | 3 +- commands/edit-meme/plankton-plan.js | 3 +- commands/edit-meme/raw.js | 3 +- commands/edit-meme/reaction-meme.js | 5 +- commands/edit-meme/scroll-of-truth.js | 3 +- commands/edit-meme/sexy-singles.js | 5 +- commands/edit-meme/skyrim-skill.js | 5 +- commands/edit-meme/sonic-says.js | 3 +- commands/edit-meme/sora-selfie.js | 5 +- commands/edit-meme/sos.js | 3 +- commands/edit-meme/spiderman-pointing.js | 3 +- commands/edit-meme/spongebob-burn.js | 3 +- commands/edit-meme/that-sign-wont-stop-me.js | 3 +- commands/edit-meme/this-guy.js | 5 +- commands/edit-meme/thug-life.js | 5 +- commands/edit-meme/to-be-continued.js | 5 +- commands/edit-meme/tuxedo-pooh.js | 3 +- commands/edit-meme/two-buttons.js | 3 +- commands/edit-meme/ugly.js | 5 +- commands/edit-meme/ultimate-tattoo.js | 5 +- commands/edit-meme/vietnam-flashbacks.js | 5 +- commands/edit-meme/whiteboard.js | 3 +- commands/edit-meme/worse-than-hitler.js | 5 +- commands/edit-meme/worthless.js | 5 +- commands/edit-text/embed.js | 6 +- commands/edit-text/mocking.js | 2 +- commands/edit-text/translate.js | 8 +- commands/events/anime-airing.js | 3 +- commands/events/apod.js | 14 ++-- commands/events/florida-man.js | 3 +- commands/events/google-doodle.js | 3 +- commands/events/horoscope.js | 8 +- commands/events/today-in-history.js | 6 +- commands/games-mp/apples-to-apples.js | 4 +- commands/games-mp/car-race.js | 4 +- commands/games-mp/cards-against-humanity.js | 4 +- commands/games-mp/imposter.js | 3 +- commands/games-sp/20-questions.js | 16 ++-- commands/games-sp/akinator.js | 34 ++++----- commands/games-sp/anime-score.js | 10 +-- commands/games-sp/captcha.js | 3 +- commands/games-sp/google-feud.js | 8 +- commands/games-sp/guess-song.js | 5 +- commands/games-sp/hearing-test.js | 3 +- commands/games-sp/horse-race.js | 3 +- commands/games-sp/pokemon-advantage.js | 3 +- commands/games-sp/tarot.js | 2 +- commands/games-sp/true-or-false.js | 8 +- commands/games-sp/whos-that-pokemon-cry.js | 5 +- commands/games-sp/whos-that-pokemon.js | 3 +- commands/info/avatar.js | 6 +- commands/info/emoji-image.js | 4 +- commands/info/first-message.js | 12 +-- commands/info/server-icon.js | 8 +- commands/other/prune.js | 5 +- commands/phone/phone-info.js | 8 +- commands/pokedex/pokedex-ability.js | 6 +- commands/pokedex/pokedex-box-sprite.js | 3 +- commands/pokedex/pokedex-cry.js | 3 +- commands/pokedex/pokedex-image.js | 3 +- commands/pokedex/pokedex-item.js | 6 +- commands/pokedex/pokedex-location.js | 12 ++- commands/pokedex/pokedex-move.js | 6 +- commands/pokedex/pokedex-moveset.js | 14 ++-- commands/pokedex/pokedex-stats.js | 16 ++-- commands/pokedex/pokedex.js | 12 ++- commands/pokedex/smogon.js | 14 ++-- commands/random-img/bird.js | 3 +- commands/random-img/bunny.js | 3 +- commands/random-img/cat.js | 3 +- commands/random-img/dog.js | 3 +- commands/random-img/duck.js | 3 +- commands/random-img/fox.js | 3 +- commands/random-img/frog.js | 3 +- commands/random-img/goose.js | 3 +- commands/random-img/inspiration.js | 3 +- commands/random-img/lizard.js | 3 +- commands/random-img/lorem-picsum.js | 3 +- commands/random-img/shiba.js | 3 +- commands/random-img/xiao.js | 3 +- commands/random-seed/friendship.js | 7 +- commands/random-seed/ship.js | 7 +- commands/random-seed/think-of.js | 7 +- commands/search/anilist.js | 3 +- commands/search/anime-character.js | 8 +- commands/search/anime-staff.js | 8 +- commands/search/anime.js | 8 +- commands/search/github.js | 8 +- commands/search/gravatar.js | 3 +- commands/search/http-cat.js | 3 +- commands/search/know-your-meme.js | 8 +- commands/search/lorcana.js | 10 +-- commands/search/magic.js | 8 +- commands/search/manga.js | 8 +- commands/search/nasa.js | 10 +-- commands/search/neopets-item.js | 8 +- commands/search/npm.js | 8 +- commands/search/periodic-table.js | 3 +- commands/search/urban.js | 10 +-- commands/search/wikipedia.js | 8 +- commands/search/xkcd.js | 16 ++-- commands/search/yu-gi-oh.js | 10 +-- commands/single/cave.js | 3 +- commands/single/dark-light.js | 3 +- commands/single/eat-pant.js | 3 +- commands/single/eggs-get-laid.js | 3 +- commands/single/fly.js | 3 +- commands/single/where-is-everybody.js | 5 +- commands/single/yoff.js | 3 +- commands/util-public/changelog.js | 4 +- commands/util-public/cloc.js | 8 +- commands/util-public/credit.js | 6 +- commands/util-public/help.js | 10 +-- commands/util-public/info.js | 10 +-- commands/util-public/report.js | 10 +-- commands/util-voice/join.js | 7 +- commands/util-voice/leave.js | 3 +- commands/util-voice/pause.js | 3 +- commands/util-voice/resume.js | 3 +- commands/util-voice/stop.js | 3 +- commands/util/banner.js | 8 +- commands/util/report-respond.js | 8 +- commands/voice/airhorn.js | 3 +- commands/voice/animalese.js | 3 +- commands/voice/dec-talk.js | 3 +- commands/voice/mindfulness.js | 3 +- commands/voice/play.js | 8 +- commands/voice/tts.js | 3 +- framework/Client.js | 6 +- framework/Extensions.js | 10 ++- framework/types/message.js | 2 +- package.json | 6 +- structures/Client.js | 2 +- structures/activity.js | 73 +++++++++++++++++++ structures/cards-against-humanity/Player.js | 2 +- structures/commands/AutoReply.js | 3 +- types/image-or-avatar.js | 2 +- util/Util.js | 14 ++-- 272 files changed, 893 insertions(+), 656 deletions(-) delete mode 100644 assets/json/activity.json create mode 100644 structures/activity.js diff --git a/Xiao.js b/Xiao.js index 1e583971..414e6dae 100644 --- a/Xiao.js +++ b/Xiao.js @@ -2,7 +2,7 @@ require('dotenv').config(); const { XIAO_TOKEN, OWNERS, XIAO_PREFIX, INVITE } = process.env; const { mkdir } = require('fs/promises'); const path = require('path'); -const { Intents, MessageEmbed } = require('discord.js'); +const { GatewayIntentBits, Partials, AllowedMentionsTypes, PermissionFlagsBits, EmbedBuilder } = require('discord.js'); const Client = require('./structures/Client'); const client = new Client({ commandPrefix: XIAO_PREFIX, @@ -10,22 +10,21 @@ const client = new Client({ owner: OWNERS.split(','), invite: INVITE, allowedMentions: { - parse: ['users'], + parse: [AllowedMentionsTypes.User], repliedUser: true }, - partials: ['GUILD_MEMBER', 'CHANNEL'], + partials: [Partials.GuildMember, Partials.Channel], intents: [ - Intents.FLAGS.GUILDS, - Intents.FLAGS.GUILD_MEMBERS, - Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, - Intents.FLAGS.GUILD_VOICE_STATES, - Intents.FLAGS.GUILD_MESSAGES, - Intents.FLAGS.GUILD_MESSAGE_REACTIONS, - Intents.FLAGS.GUILD_MESSAGE_TYPING, - Intents.FLAGS.GUILD_WEBHOOKS, - Intents.FLAGS.DIRECT_MESSAGES, - Intents.FLAGS.DIRECT_MESSAGE_REACTIONS, - Intents.FLAGS.DIRECT_MESSAGE_TYPING + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildEmojisAndStickers, + GatewayIntentBits.GuildVoiceStates, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.GuildMessageReactions, + GatewayIntentBits.GuildMessageTyping, + GatewayIntentBits.DirectMessages, + GatewayIntentBits.DirectMessageReactions, + GatewayIntentBits.DirectMessageTyping ] }); const { formatNumber, checkFileExists } = require('./util/Util'); @@ -73,17 +72,10 @@ client.on('ready', async () => { const decTalkFolderExists = await checkFileExists(path.join(__dirname, 'tmp', 'dec-talk')); if (!decTalkFolderExists) await mkdir(path.join(__dirname, 'tmp', 'dec-talk')); - // Push client-related activities - client.activities.push( - { text: () => `${formatNumber(client.guilds.cache.size)} servers`, type: 'WATCHING' }, - { text: () => `with ${formatNumber(client.registry.commands.size)} commands`, type: 'PLAYING' }, - { text: () => `${formatNumber(client.channels.cache.size)} channels`, type: 'WATCHING' } - ); - // Interval to change activity every minute setInterval(() => { const activity = client.activities[Math.floor(Math.random() * client.activities.length)]; - const text = typeof activity.text === 'function' ? activity.text() : activity.text; + const text = typeof activity.text === 'function' ? activity.text(client) : activity.text; client.user.setActivity(text, { type: activity.type }); }, 60000); @@ -221,7 +213,7 @@ client.on('ready', async () => { client.logger.info('[FACE DETECTOR] Loaded face detector.'); // Fetch all members - for (const [id, guild] of client.guilds.cache) { // eslint-disable-line no-unused-vars + for (const [, guild] of client.guilds.cache) { await guild.members.fetch(); } client.logger.info('[MEMBERS] Fetched all guild members.'); @@ -281,7 +273,7 @@ client.on('guildCreate', async guild => { return; } } - if (guild.systemChannel && guild.systemChannel.permissionsFor(client.user).has('SEND_MESSAGES')) { + if (guild.systemChannel && guild.systemChannel.permissionsFor(client.user).has(PermissionFlagsBits.SendMessages)) { try { const usage = client.registry.commands.get('help').usage(); await guild.systemChannel.send(`Hi! I'm Xiao, use ${usage} to see my commands, yes?`); @@ -292,11 +284,11 @@ client.on('guildCreate', async guild => { const joinLeaveChannel = await client.fetchJoinLeaveChannel(); if (joinLeaveChannel) { const owner = await guild.fetchOwner(); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x7CFC00) - .setThumbnail(guild.iconURL({ format: 'png' })) + .setThumbnail(guild.iconURL({ extension: 'png' })) .setTitle(`Joined ${guild.name}!`) - .setFooter(`ID: ${guild.id}`) + .setFooter({ text: `ID: ${guild.id}` }) .setTimestamp() .addField('❯ Members', formatNumber(guild.memberCount)) .addField('❯ Owner', owner.user.tag); @@ -308,11 +300,11 @@ client.on('guildDelete', async guild => { const joinLeaveChannel = await client.fetchJoinLeaveChannel(); if (joinLeaveChannel) { const owner = client.users.cache.get(guild.ownerID); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xFF0000) - .setThumbnail(guild.iconURL({ format: 'png' })) + .setThumbnail(guild.iconURL({ extension: 'png' })) .setTitle(`Left ${guild.name}...`) - .setFooter(`ID: ${guild.id}`) + .setFooter({ text: `ID: ${guild.id}` }) .setTimestamp() .addField('❯ Members', formatNumber(guild.memberCount)) .addField('❯ Owner', owner ? owner.tag : guild.ownerID); diff --git a/assets/json/activity.json b/assets/json/activity.json deleted file mode 100644 index f50fc1b7..00000000 --- a/assets/json/activity.json +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "text": "Rune Factory 4", - "type": "PLAYING" - }, - { - "text": "with your heart", - "type": "PLAYING" - }, - { - "text": "you eat pant", - "type": "WATCHING" - }, - { - "text": "anime", - "type": "WATCHING" - }, - { - "text": "over the inn", - "type": "WATCHING" - }, - { - "text": "at the inn", - "type": "PLAYING" - }, - { - "text": "in Selphia", - "type": "PLAYING" - }, - { - "text": "with Amber", - "type": "PLAYING" - }, - { - "text": "with a cardboard box", - "type": "PLAYING" - }, - { - "text": "in the fridge", - "type": "PLAYING" - }, - { - "text": "with a knife", - "type": "PLAYING" - }, - { - "text": "with a murderous cow", - "type": "PLAYING" - }, - { - "text": "with a linter", - "type": "PLAYING" - } -] diff --git a/commands/analyze/screenshot.js b/commands/analyze/screenshot.js index a0b854ac..54bea40e 100644 --- a/commands/analyze/screenshot.js +++ b/commands/analyze/screenshot.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { isImageNSFW, isUrlNSFW } = require('../../util/Util'); @@ -10,7 +11,7 @@ module.exports = class ScreenshotCommand extends Command { group: 'analyze', memberName: 'screenshot', description: 'Takes a screenshot of any webpage.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], throttling: { usages: 2, duration: 30 diff --git a/commands/edit-avatar/avatar-fusion.js b/commands/edit-avatar/avatar-fusion.js index 94158784..49fc9fc9 100644 --- a/commands/edit-avatar/avatar-fusion.js +++ b/commands/edit-avatar/avatar-fusion.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -14,7 +15,7 @@ module.exports = class AvatarFusionCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'overlay', @@ -30,8 +31,8 @@ module.exports = class AvatarFusionCommand extends Command { } async run(msg, { overlay, base }) { - const baseAvatarURL = base.displayAvatarURL({ format: 'png', size: 512 }); - const overlayAvatarURL = overlay.displayAvatarURL({ format: 'png', size: 512 }); + const baseAvatarURL = base.displayAvatarURL({ extension: 'png', size: 512 }); + const overlayAvatarURL = overlay.displayAvatarURL({ extension: 'png', size: 512 }); const baseAvatarData = await request.get(baseAvatarURL); const baseAvatar = await loadImage(baseAvatarData.body); const overlayAvatarData = await request.get(overlayAvatarURL); diff --git a/commands/edit-avatar/eject.js b/commands/edit-avatar/eject.js index 902e19e5..902cc03f 100644 --- a/commands/edit-avatar/eject.js +++ b/commands/edit-avatar/eject.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const GIFEncoder = require('gifencoder'); const { MersenneTwister19937, bool } = require('random-js'); @@ -18,7 +19,7 @@ module.exports = class EjectCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Wisq', @@ -55,7 +56,7 @@ module.exports = class EjectCommand extends Command { } async run(msg, { user, imposter }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); if (imposter === '') { diff --git a/commands/edit-avatar/fire.js b/commands/edit-avatar/fire.js index 8d410814..f7d8a2b9 100644 --- a/commands/edit-avatar/fire.js +++ b/commands/edit-avatar/fire.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const GIFEncoder = require('gifencoder'); const request = require('node-superfetch'); @@ -19,7 +20,7 @@ module.exports = class FireCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'LowGif', @@ -39,7 +40,7 @@ module.exports = class FireCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); const encoder = new GIFEncoder(avatar.width, avatar.height); diff --git a/commands/edit-avatar/hat.js b/commands/edit-avatar/hat.js index 0ba3d8ad..c5a79bb9 100644 --- a/commands/edit-avatar/hat.js +++ b/commands/edit-avatar/hat.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -18,7 +19,7 @@ module.exports = class HatCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Go Nintendo', @@ -138,7 +139,7 @@ module.exports = class HatCommand extends Command { } async run(msg, { type, user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`)); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/he-lives-in-you.js b/commands/edit-avatar/he-lives-in-you.js index 4a5e830d..0a12b8b8 100644 --- a/commands/edit-avatar/he-lives-in-you.js +++ b/commands/edit-avatar/he-lives-in-you.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class HeLivesInYouCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Disney', @@ -36,7 +37,7 @@ module.exports = class HeLivesInYouCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 256 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/hearts.js b/commands/edit-avatar/hearts.js index cc6c49fb..fb20acca 100644 --- a/commands/edit-avatar/hearts.js +++ b/commands/edit-avatar/hearts.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class HeartsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Jessica Knable', @@ -36,7 +37,7 @@ module.exports = class HeartsCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hearts.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/i-have-the-power.js b/commands/edit-avatar/i-have-the-power.js index 12dcdf80..4aa2ba55 100644 --- a/commands/edit-avatar/i-have-the-power.js +++ b/commands/edit-avatar/i-have-the-power.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class IHaveThePowerCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Mattel', @@ -34,7 +35,7 @@ module.exports = class IHaveThePowerCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 256 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'i-have-the-power.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/rip.js b/commands/edit-avatar/rip.js index 744f1669..688bd423 100644 --- a/commands/edit-avatar/rip.js +++ b/commands/edit-avatar/rip.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class RipCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'vician', @@ -48,7 +49,7 @@ module.exports = class RipCommand extends Command { } async run(msg, { user, cause }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rip.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/status-button.js b/commands/edit-avatar/status-button.js index 593c7b50..04fbcab7 100644 --- a/commands/edit-avatar/status-button.js +++ b/commands/edit-avatar/status-button.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); module.exports = class StatusButtonCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class StatusButtonCommand extends Command { group: 'edit-avatar', memberName: 'status-button', description: 'Creates a Discord status button from c99.nl.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Discord Status Button', diff --git a/commands/edit-avatar/steam-now-playing.js b/commands/edit-avatar/steam-now-playing.js index 4aa8ab04..bf2e52e5 100644 --- a/commands/edit-avatar/steam-now-playing.js +++ b/commands/edit-avatar/steam-now-playing.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class SteamNowPlayingCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Steam', @@ -45,7 +46,7 @@ module.exports = class SteamNowPlayingCommand extends Command { } async run(msg, { game, user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 64 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-now-playing.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-avatar/triggered.js b/commands/edit-avatar/triggered.js index 892a660f..e6fad69e 100644 --- a/commands/edit-avatar/triggered.js +++ b/commands/edit-avatar/triggered.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const GIFEncoder = require('gifencoder'); const request = require('node-superfetch'); @@ -20,7 +21,7 @@ module.exports = class TriggeredCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'NotAWeebDev', @@ -41,7 +42,7 @@ module.exports = class TriggeredCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-image-text/ace-attorney.js b/commands/edit-image-text/ace-attorney.js index 3a16e9ae..a815d8e8 100644 --- a/commands/edit-image-text/ace-attorney.js +++ b/commands/edit-image-text/ace-attorney.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { firstUpperCase } = require('../../util/Util'); @@ -31,7 +32,7 @@ module.exports = class AceAttorneyCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Capcom', diff --git a/commands/edit-image-text/achievement.js b/commands/edit-image-text/achievement.js index e9b3013f..41af8c41 100644 --- a/commands/edit-image-text/achievement.js +++ b/commands/edit-image-text/achievement.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { shortenText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class AchievementCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Mojang', diff --git a/commands/edit-image-text/axis-cult-sign-up.js b/commands/edit-image-text/axis-cult-sign-up.js index 2892232d..357ac67f 100644 --- a/commands/edit-image-text/axis-cult-sign-up.js +++ b/commands/edit-image-text/axis-cult-sign-up.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class AxisCultSignUpCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'cheesecakejedi', diff --git a/commands/edit-image-text/caution.js b/commands/edit-image-text/caution.js index d9db1bf3..1661b127 100644 --- a/commands/edit-image-text/caution.js +++ b/commands/edit-image-text/caution.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class CautionCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-image-text/certificate.js b/commands/edit-image-text/certificate.js index cd41de83..e6b2e9fb 100644 --- a/commands/edit-image-text/certificate.js +++ b/commands/edit-image-text/certificate.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const moment = require('moment'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class CertificateCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Creative Certificates', diff --git a/commands/edit-image-text/chinese-restaurant.js b/commands/edit-image-text/chinese-restaurant.js index 81ec1317..6cc749a0 100644 --- a/commands/edit-image-text/chinese-restaurant.js +++ b/commands/edit-image-text/chinese-restaurant.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ChineseRestaurantCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ATOM.SMASHER.ORG', diff --git a/commands/edit-image-text/danger.js b/commands/edit-image-text/danger.js index 06631daa..98768a0c 100644 --- a/commands/edit-image-text/danger.js +++ b/commands/edit-image-text/danger.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class DangerCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-image-text/gandhi-quote.js b/commands/edit-image-text/gandhi-quote.js index be7df76b..07d7aaa2 100644 --- a/commands/edit-image-text/gandhi-quote.js +++ b/commands/edit-image-text/gandhi-quote.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class GandhiQuoteCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'GUST e-foundry', diff --git a/commands/edit-image-text/highway-sign.js b/commands/edit-image-text/highway-sign.js index f1067b38..a1c80ab6 100644 --- a/commands/edit-image-text/highway-sign.js +++ b/commands/edit-image-text/highway-sign.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class HighwaySignCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ATOM.SMASHER.ORG', diff --git a/commands/edit-image-text/hollywood-star.js b/commands/edit-image-text/hollywood-star.js index e690c63f..d086104b 100644 --- a/commands/edit-image-text/hollywood-star.js +++ b/commands/edit-image-text/hollywood-star.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class HollywoodStarCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'RedKid.Net', diff --git a/commands/edit-image-text/jeopardy-question.js b/commands/edit-image-text/jeopardy-question.js index 84626344..f6ebecf1 100644 --- a/commands/edit-image-text/jeopardy-question.js +++ b/commands/edit-image-text/jeopardy-question.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas } = require('canvas'); const { wrapText } = require('../../util/Canvas'); @@ -14,7 +15,7 @@ module.exports = class JeopardyQuestionCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Jeopardy', diff --git a/commands/edit-image-text/license-plate.js b/commands/edit-image-text/license-plate.js index db66cfe1..957aeaa1 100644 --- a/commands/edit-image-text/license-plate.js +++ b/commands/edit-image-text/license-plate.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -13,7 +14,7 @@ module.exports = class LicensePlateCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Dave Hansen', diff --git a/commands/edit-image-text/speed-limit.js b/commands/edit-image-text/speed-limit.js index 1fb7bae3..e103770f 100644 --- a/commands/edit-image-text/speed-limit.js +++ b/commands/edit-image-text/speed-limit.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class SpeedLimitCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'RoadTrafficSigns', diff --git a/commands/edit-image-text/spongebob-time-card.js b/commands/edit-image-text/spongebob-time-card.js index 46dc9b91..a55c52a6 100644 --- a/commands/edit-image-text/spongebob-time-card.js +++ b/commands/edit-image-text/spongebob-time-card.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class SpongebobTimeCardCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelodeon', diff --git a/commands/edit-image-text/tweet.js b/commands/edit-image-text/tweet.js index 544b6e8a..c6ce9ffa 100644 --- a/commands/edit-image-text/tweet.js +++ b/commands/edit-image-text/tweet.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const { TwitterOpenApi } = require('twitter-openapi-typescript'); const api = new TwitterOpenApi(); @@ -20,7 +21,7 @@ module.exports = class TweetCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Twitter', @@ -156,7 +157,7 @@ module.exports = class TweetCommand extends Command { followers: body.followersCount }; } catch { - const avatarRes = await request.get(msg.author.displayAvatarURL({ format: 'png', size: 64 })); + const avatarRes = await request.get(msg.author.displayAvatarURL({ extension: 'png', size: 64 })); return { screenName: msg.author.username.slice(0, 15), name: msg.member ? msg.member.displayName.slice(0, 50) : msg.author.username.slice(0, 50), diff --git a/commands/edit-image-text/undertale.js b/commands/edit-image-text/undertale.js index 69e060d8..f1c54623 100644 --- a/commands/edit-image-text/undertale.js +++ b/commands/edit-image-text/undertale.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -25,7 +26,7 @@ module.exports = class UndertaleCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'UNDERTALE', diff --git a/commands/edit-image-text/zero-dialogue.js b/commands/edit-image-text/zero-dialogue.js index 32e937c8..80d404b9 100644 --- a/commands/edit-image-text/zero-dialogue.js +++ b/commands/edit-image-text/zero-dialogue.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -27,7 +28,7 @@ module.exports = class ZeroDialogueCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Capcom', diff --git a/commands/edit-image/approved.js b/commands/edit-image/approved.js index b7423d42..b0bef4d6 100644 --- a/commands/edit-image/approved.js +++ b/commands/edit-image/approved.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ApprovedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Redeeming God', @@ -29,7 +30,7 @@ module.exports = class ApprovedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/ascii.js b/commands/edit-image/ascii.js index b6c35d08..e62789c1 100644 --- a/commands/edit-image/ascii.js +++ b/commands/edit-image/ascii.js @@ -18,7 +18,7 @@ module.exports = class AsciiCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/blur.js b/commands/edit-image/blur.js index 62d93abf..d26ef5d9 100644 --- a/commands/edit-image/blur.js +++ b/commands/edit-image/blur.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const stackBlur = require('stackblur-canvas'); @@ -15,7 +16,7 @@ module.exports = class BlurCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'radius', @@ -26,7 +27,7 @@ module.exports = class BlurCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/bob-ross.js b/commands/edit-image/bob-ross.js index fd3b2c25..5bcd73cf 100644 --- a/commands/edit-image/bob-ross.js +++ b/commands/edit-image/bob-ross.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class BobRossCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Know Your Meme', @@ -34,7 +35,7 @@ module.exports = class BobRossCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/brazzers.js b/commands/edit-image/brazzers.js index 45ea47ec..6e5983c7 100644 --- a/commands/edit-image/brazzers.js +++ b/commands/edit-image/brazzers.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class BrazzersCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Brazzers', @@ -27,7 +28,7 @@ module.exports = class BrazzersCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/charcoal.js b/commands/edit-image/charcoal.js index dcc0e76b..e885dfe7 100644 --- a/commands/edit-image/charcoal.js +++ b/commands/edit-image/charcoal.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -14,7 +15,7 @@ module.exports = class CharcoalCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -26,7 +27,7 @@ module.exports = class CharcoalCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/chocolate-milk.js b/commands/edit-image/chocolate-milk.js index 81c0235f..4ae9fa12 100644 --- a/commands/edit-image/chocolate-milk.js +++ b/commands/edit-image/chocolate-milk.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,12 +16,12 @@ module.exports = class ChocolateMilkCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) }, { key: 'direction', diff --git a/commands/edit-image/circle.js b/commands/edit-image/circle.js index 56828080..64819b77 100644 --- a/commands/edit-image/circle.js +++ b/commands/edit-image/circle.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -14,12 +15,12 @@ module.exports = class CircleCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/color.js b/commands/edit-image/color.js index 76850458..bbab80d8 100644 --- a/commands/edit-image/color.js +++ b/commands/edit-image/color.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas } = require('canvas'); const ntc = require('ntcjs'); @@ -14,7 +15,7 @@ module.exports = class ColorCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'color', diff --git a/commands/edit-image/communist.js b/commands/edit-image/communist.js index 5e8c380e..8a84c0ba 100644 --- a/commands/edit-image/communist.js +++ b/commands/edit-image/communist.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class CommunistCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'PNGFuel', @@ -29,7 +30,7 @@ module.exports = class CommunistCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/contrast.js b/commands/edit-image/contrast.js index 911c23db..757cdf68 100644 --- a/commands/edit-image/contrast.js +++ b/commands/edit-image/contrast.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { contrast } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class ContrastCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/convert-image.js b/commands/edit-image/convert-image.js index 265d7a8e..94a1f9e9 100644 --- a/commands/edit-image/convert-image.js +++ b/commands/edit-image/convert-image.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const formats = { @@ -20,7 +21,7 @@ module.exports = class ConvertImageCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'format', diff --git a/commands/edit-image/desaturate.js b/commands/edit-image/desaturate.js index 05c1f0fd..079b403a 100644 --- a/commands/edit-image/desaturate.js +++ b/commands/edit-image/desaturate.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { desaturate } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class DesaturateCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'level', @@ -24,7 +25,7 @@ module.exports = class DesaturateCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/dexter.js b/commands/edit-image/dexter.js index ae57830f..e9b93768 100644 --- a/commands/edit-image/dexter.js +++ b/commands/edit-image/dexter.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class DexterCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', @@ -27,7 +28,7 @@ module.exports = class DexterCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-image/distort.js b/commands/edit-image/distort.js index 548aa904..1eb967ab 100644 --- a/commands/edit-image/distort.js +++ b/commands/edit-image/distort.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { distort } = require('../../util/Canvas'); @@ -14,7 +15,7 @@ module.exports = class DistortCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'level', @@ -23,7 +24,7 @@ module.exports = class DistortCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/emboss.js b/commands/edit-image/emboss.js index a3e3c199..01982f55 100644 --- a/commands/edit-image/emboss.js +++ b/commands/edit-image/emboss.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -14,7 +15,7 @@ module.exports = class EmbossCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -26,7 +27,7 @@ module.exports = class EmbossCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/fire-frame.js b/commands/edit-image/fire-frame.js index 189283f2..1f684a51 100644 --- a/commands/edit-image/fire-frame.js +++ b/commands/edit-image/fire-frame.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class FireFrameCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'susi1959', @@ -29,7 +30,7 @@ module.exports = class FireFrameCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/fish-eye.js b/commands/edit-image/fish-eye.js index 8d37537a..40afccda 100644 --- a/commands/edit-image/fish-eye.js +++ b/commands/edit-image/fish-eye.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { fishEye } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class FishEyeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Hackyon', @@ -33,7 +34,7 @@ module.exports = class FishEyeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/frame.js b/commands/edit-image/frame.js index c35ab9c3..5e1047d7 100644 --- a/commands/edit-image/frame.js +++ b/commands/edit-image/frame.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -17,7 +18,7 @@ module.exports = class FrameCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'www.aljanh.net', @@ -36,7 +37,7 @@ module.exports = class FrameCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/ghost.js b/commands/edit-image/ghost.js index fb6acb9c..425d93b4 100644 --- a/commands/edit-image/ghost.js +++ b/commands/edit-image/ghost.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -13,12 +14,12 @@ module.exports = class GhostCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/glass-shatter.js b/commands/edit-image/glass-shatter.js index 57002ba5..d92d5ecc 100644 --- a/commands/edit-image/glass-shatter.js +++ b/commands/edit-image/glass-shatter.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class GlassShatterCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Platinum Designz', @@ -28,7 +29,7 @@ module.exports = class GlassShatterCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/glitch.js b/commands/edit-image/glitch.js index f6838303..18b51a06 100644 --- a/commands/edit-image/glitch.js +++ b/commands/edit-image/glitch.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { distort } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class GlitchCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/greyscale.js b/commands/edit-image/greyscale.js index 2e7fbbd6..be82376e 100644 --- a/commands/edit-image/greyscale.js +++ b/commands/edit-image/greyscale.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { greyscale } = require('../../util/Canvas'); @@ -15,12 +16,12 @@ module.exports = class GreyscaleCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/gun.js b/commands/edit-image/gun.js index 6eafc8d3..2a2ad21f 100644 --- a/commands/edit-image/gun.js +++ b/commands/edit-image/gun.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class GunCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Luxoflux', @@ -27,7 +28,7 @@ module.exports = class GunCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/hands.js b/commands/edit-image/hands.js index 0355c63e..8db3c7bc 100644 --- a/commands/edit-image/hands.js +++ b/commands/edit-image/hands.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class HandsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Know Your Meme', @@ -28,7 +29,7 @@ module.exports = class HandsCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/ifunny.js b/commands/edit-image/ifunny.js index 2e6ef537..5db57ff4 100644 --- a/commands/edit-image/ifunny.js +++ b/commands/edit-image/ifunny.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class IfunnyCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'iFunny', @@ -26,7 +27,7 @@ module.exports = class IfunnyCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/implode.js b/commands/edit-image/implode.js index 8e1bbf26..cf248abd 100644 --- a/commands/edit-image/implode.js +++ b/commands/edit-image/implode.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -14,7 +15,7 @@ module.exports = class ImplodeCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -32,7 +33,7 @@ module.exports = class ImplodeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/invert.js b/commands/edit-image/invert.js index 733cece6..a0406777 100644 --- a/commands/edit-image/invert.js +++ b/commands/edit-image/invert.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { invert } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class InvertCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/lego-icon.js b/commands/edit-image/lego-icon.js index 17777d1f..31dddfc7 100644 --- a/commands/edit-image/lego-icon.js +++ b/commands/edit-image/lego-icon.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class LegoIconCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'LEGO', @@ -34,7 +35,7 @@ module.exports = class LegoIconCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/liquid-rescale.js b/commands/edit-image/liquid-rescale.js index c488c937..ac57cdac 100644 --- a/commands/edit-image/liquid-rescale.js +++ b/commands/edit-image/liquid-rescale.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class LiquidRescaleCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -27,7 +28,7 @@ module.exports = class LiquidRescaleCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/mirror.js b/commands/edit-image/mirror.js index ee45b5aa..ab215f6f 100644 --- a/commands/edit-image/mirror.js +++ b/commands/edit-image/mirror.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const types = ['x', 'y', 'both']; @@ -14,7 +15,7 @@ module.exports = class MirrorCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'type', @@ -25,7 +26,7 @@ module.exports = class MirrorCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/motion-blur.js b/commands/edit-image/motion-blur.js index 8eb13e71..575a465e 100644 --- a/commands/edit-image/motion-blur.js +++ b/commands/edit-image/motion-blur.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { motionBlur } = require('../../util/Canvas'); @@ -15,12 +16,12 @@ module.exports = class MotionBlurCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/needs-more-jpeg.js b/commands/edit-image/needs-more-jpeg.js index cadeedd5..ac1e62e6 100644 --- a/commands/edit-image/needs-more-jpeg.js +++ b/commands/edit-image/needs-more-jpeg.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -14,7 +15,7 @@ module.exports = class NeedsMoreJpegCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'quality', @@ -26,7 +27,7 @@ module.exports = class NeedsMoreJpegCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/noise.js b/commands/edit-image/noise.js index b15c5b58..f76308d7 100644 --- a/commands/edit-image/noise.js +++ b/commands/edit-image/noise.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -16,7 +17,7 @@ module.exports = class NoiseCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -34,7 +35,7 @@ module.exports = class NoiseCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/oil-painting.js b/commands/edit-image/oil-painting.js index fc53b643..c72da9cf 100644 --- a/commands/edit-image/oil-painting.js +++ b/commands/edit-image/oil-painting.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class OilPaintingCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -27,7 +28,7 @@ module.exports = class OilPaintingCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/pet.js b/commands/edit-image/pet.js index 8b83c478..48373d7a 100644 --- a/commands/edit-image/pet.js +++ b/commands/edit-image/pet.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const GIFEncoder = require('gifencoder'); const request = require('node-superfetch'); @@ -18,12 +19,12 @@ module.exports = class PetCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 128 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 128 }) } ] }); diff --git a/commands/edit-image/pixelize.js b/commands/edit-image/pixelize.js index 31edb9c4..a761c71b 100644 --- a/commands/edit-image/pixelize.js +++ b/commands/edit-image/pixelize.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { pixelize } = require('../../util/Canvas'); @@ -15,12 +16,12 @@ module.exports = class PixelizeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/pokemon-fusion.js b/commands/edit-image/pokemon-fusion.js index e88ca54f..85824d6d 100644 --- a/commands/edit-image/pokemon-fusion.js +++ b/commands/edit-image/pokemon-fusion.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const pokemon = require('../../assets/json/pokemon-fusion'); const { firstUpperCase } = require('../../util/Util'); const pokeKeys = Object.keys(pokemon); @@ -11,7 +12,7 @@ module.exports = class PokemonFusionCommand extends Command { group: 'edit-image', memberName: 'pokemon-fusion', description: 'Fuses two Generation I Pokémon together.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', diff --git a/commands/edit-image/police-tape.js b/commands/edit-image/police-tape.js index c846b175..5d50c26a 100644 --- a/commands/edit-image/police-tape.js +++ b/commands/edit-image/police-tape.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class PoliceTapeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'PNG Arts', @@ -29,7 +30,7 @@ module.exports = class PoliceTapeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/rainbow.js b/commands/edit-image/rainbow.js index e5ccd9ab..63808f45 100644 --- a/commands/edit-image/rainbow.js +++ b/commands/edit-image/rainbow.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,12 +16,12 @@ module.exports = class RainbowCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/rejected.js b/commands/edit-image/rejected.js index 0494ddee..d794a363 100644 --- a/commands/edit-image/rejected.js +++ b/commands/edit-image/rejected.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class RejctedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Clipart Library', @@ -29,7 +30,7 @@ module.exports = class RejctedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/resize.js b/commands/edit-image/resize.js index 669bd56e..753bb0da 100644 --- a/commands/edit-image/resize.js +++ b/commands/edit-image/resize.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -13,7 +14,7 @@ module.exports = class ResizeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'width', @@ -30,7 +31,7 @@ module.exports = class ResizeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-image/rotate.js b/commands/edit-image/rotate.js index 8f7a4980..96c384f2 100644 --- a/commands/edit-image/rotate.js +++ b/commands/edit-image/rotate.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -13,7 +14,7 @@ module.exports = class RotateCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'degrees', @@ -24,7 +25,7 @@ module.exports = class RotateCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/sepia.js b/commands/edit-image/sepia.js index cc079a8f..e219aab0 100644 --- a/commands/edit-image/sepia.js +++ b/commands/edit-image/sepia.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { sepia } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class SepiaCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/shake.js b/commands/edit-image/shake.js index d2b82f68..62ffce73 100644 --- a/commands/edit-image/shake.js +++ b/commands/edit-image/shake.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const GIFEncoder = require('gifencoder'); const request = require('node-superfetch'); @@ -16,7 +17,7 @@ module.exports = class ShakeCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'amount', @@ -27,7 +28,7 @@ module.exports = class ShakeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/silhouette.js b/commands/edit-image/silhouette.js index b16491c2..cbf9de65 100644 --- a/commands/edit-image/silhouette.js +++ b/commands/edit-image/silhouette.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { silhouette } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class SilhouetteCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/sip.js b/commands/edit-image/sip.js index 7b01cc38..666b97f4 100644 --- a/commands/edit-image/sip.js +++ b/commands/edit-image/sip.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class SipCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'CoolClips.com', @@ -28,7 +29,7 @@ module.exports = class SipCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) }, { key: 'direction', diff --git a/commands/edit-image/sketch.js b/commands/edit-image/sketch.js index db4d8062..5863c43b 100644 --- a/commands/edit-image/sketch.js +++ b/commands/edit-image/sketch.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer, reactIfAble } = require('../../util/Util'); @@ -16,7 +17,7 @@ module.exports = class SketchCommand extends Command { usages: 1, duration: 60 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -28,7 +29,7 @@ module.exports = class SketchCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/snapchat.js b/commands/edit-image/snapchat.js index 6209edd5..b2afa754 100644 --- a/commands/edit-image/snapchat.js +++ b/commands/edit-image/snapchat.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -14,7 +15,7 @@ module.exports = class SnapchatCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -37,7 +38,7 @@ module.exports = class SnapchatCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/spotify-now-playing.js b/commands/edit-image/spotify-now-playing.js index 7cb44509..e7c7fcc3 100644 --- a/commands/edit-image/spotify-now-playing.js +++ b/commands/edit-image/spotify-now-playing.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class SpotifyNowPlayingCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Spotify', @@ -49,7 +50,7 @@ module.exports = class SpotifyNowPlayingCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-image/square.js b/commands/edit-image/square.js index 9b3b077f..7f84311d 100644 --- a/commands/edit-image/square.js +++ b/commands/edit-image/square.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -13,12 +14,12 @@ module.exports = class SquareCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/squish.js b/commands/edit-image/squish.js index 48f28665..db07b8f4 100644 --- a/commands/edit-image/squish.js +++ b/commands/edit-image/squish.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class SquishCommand extends Command { usages: 2, duration: 60 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -33,7 +34,7 @@ module.exports = class SquishCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/steam-card.js b/commands/edit-image/steam-card.js index 7a898d59..0ff6f5f7 100644 --- a/commands/edit-image/steam-card.js +++ b/commands/edit-image/steam-card.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class SteamCardCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Steam', @@ -45,7 +46,7 @@ module.exports = class SteamCardCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-image/subtitle.js b/commands/edit-image/subtitle.js index 2fbd7fff..f3d6f4bb 100644 --- a/commands/edit-image/subtitle.js +++ b/commands/edit-image/subtitle.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class SubtitleCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -33,7 +34,7 @@ module.exports = class SubtitleCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/swirl.js b/commands/edit-image/swirl.js index b741d8fe..423b8770 100644 --- a/commands/edit-image/swirl.js +++ b/commands/edit-image/swirl.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const gm = require('gm').subClass({ imageMagick: '7+' }); const request = require('node-superfetch'); const { magikToBuffer } = require('../../util/Util'); @@ -14,7 +15,7 @@ module.exports = class SwirlCommand extends Command { usages: 2, duration: 15 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ImageMagick', @@ -32,7 +33,7 @@ module.exports = class SwirlCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/tint.js b/commands/edit-image/tint.js index 1d010be7..168db60d 100644 --- a/commands/edit-image/tint.js +++ b/commands/edit-image/tint.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { drawImageWithTint } = require('../../util/Canvas'); @@ -14,7 +15,7 @@ module.exports = class TintCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'color', @@ -24,7 +25,7 @@ module.exports = class TintCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/vignette.js b/commands/edit-image/vignette.js index 7d9304c4..c87090be 100644 --- a/commands/edit-image/vignette.js +++ b/commands/edit-image/vignette.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { vignette } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class VignetteCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/wanted.js b/commands/edit-image/wanted.js index 44cf4aec..7fb414fa 100644 --- a/commands/edit-image/wanted.js +++ b/commands/edit-image/wanted.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class WantedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Tim\'s Printables', @@ -29,7 +30,7 @@ module.exports = class WantedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/wild-pokemon.js b/commands/edit-image/wild-pokemon.js index be743a6a..a503d91f 100644 --- a/commands/edit-image/wild-pokemon.js +++ b/commands/edit-image/wild-pokemon.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class WildPokemonCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', @@ -39,7 +40,7 @@ module.exports = class WildPokemonCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 128 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 128 }) } ] }); diff --git a/commands/edit-image/you-died.js b/commands/edit-image/you-died.js index c2eed5c0..e98140bf 100644 --- a/commands/edit-image/you-died.js +++ b/commands/edit-image/you-died.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class YouDiedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'FromSoftware', @@ -28,7 +29,7 @@ module.exports = class YouDiedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-image/yu-gi-oh-gen.js b/commands/edit-image/yu-gi-oh-gen.js index 5fb9c6ef..ccaca2b8 100644 --- a/commands/edit-image/yu-gi-oh-gen.js +++ b/commands/edit-image/yu-gi-oh-gen.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -21,7 +22,7 @@ module.exports = class YuGiOhGenCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Konami', @@ -59,7 +60,7 @@ module.exports = class YuGiOhGenCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/3000-years.js b/commands/edit-meme/3000-years.js index 7fcc5b7f..3ed29c62 100644 --- a/commands/edit-meme/3000-years.js +++ b/commands/edit-meme/3000-years.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ThreeThousandYearsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', @@ -28,7 +29,7 @@ module.exports = class ThreeThousandYearsCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/alert.js b/commands/edit-meme/alert.js index fae4c11f..e004f705 100644 --- a/commands/edit-meme/alert.js +++ b/commands/edit-meme/alert.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class AlertCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Apple', diff --git a/commands/edit-meme/bart-chalkboard.js b/commands/edit-meme/bart-chalkboard.js index 32986acc..c1217e23 100644 --- a/commands/edit-meme/bart-chalkboard.js +++ b/commands/edit-meme/bart-chalkboard.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { shortenText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class LisaPresentationCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '20th Century Fox', diff --git a/commands/edit-meme/be-like-bill.js b/commands/edit-meme/be-like-bill.js index 448c8a5d..4528ff35 100644 --- a/commands/edit-meme/be-like-bill.js +++ b/commands/edit-meme/be-like-bill.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const { stripIndents } = require('common-tags'); const path = require('path'); @@ -17,7 +18,7 @@ module.exports = class BeLikeBillCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'gautamkrishnar', diff --git a/commands/edit-meme/beautiful.js b/commands/edit-meme/beautiful.js index 4203b135..067b4e29 100644 --- a/commands/edit-meme/beautiful.js +++ b/commands/edit-meme/beautiful.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class BeautifulCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Disney', @@ -40,7 +41,7 @@ module.exports = class BeautifulCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 128 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-meme/boardroom-meeting.js b/commands/edit-meme/boardroom-meeting.js index b76315c1..70c04013 100644 --- a/commands/edit-meme/boardroom-meeting.js +++ b/commands/edit-meme/boardroom-meeting.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class BoardroomMeetingCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'hejibits', diff --git a/commands/edit-meme/bottom-text.js b/commands/edit-meme/bottom-text.js index c87ba776..99c79b80 100644 --- a/commands/edit-meme/bottom-text.js +++ b/commands/edit-meme/bottom-text.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class BottomTextCommand extends Command { constructor(client) { @@ -11,7 +12,7 @@ module.exports = class BottomTextCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ShareFonts.net', @@ -30,7 +31,7 @@ module.exports = class BottomTextCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/catch.js b/commands/edit-meme/catch.js index 43c14273..48826f18 100644 --- a/commands/edit-meme/catch.js +++ b/commands/edit-meme/catch.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { delay } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class CatchCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/challenger.js b/commands/edit-meme/challenger.js index 9fbe79c6..bae0972d 100644 --- a/commands/edit-meme/challenger.js +++ b/commands/edit-meme/challenger.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ChallengerCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Jack The Awesomeness Gamer', @@ -45,7 +46,7 @@ module.exports = class ChallengerCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/change-my-mind.js b/commands/edit-meme/change-my-mind.js index e70e38dd..2c4f5610 100644 --- a/commands/edit-meme/change-my-mind.js +++ b/commands/edit-meme/change-my-mind.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ChangeMyMindCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Steven Crowder', diff --git a/commands/edit-meme/chi-idea.js b/commands/edit-meme/chi-idea.js index a21983e9..33bad121 100644 --- a/commands/edit-meme/chi-idea.js +++ b/commands/edit-meme/chi-idea.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ChiIdeaCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'u/THANOS_COPTER', diff --git a/commands/edit-meme/crush.js b/commands/edit-meme/crush.js index f8274039..ca634990 100644 --- a/commands/edit-meme/crush.js +++ b/commands/edit-meme/crush.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class CrushCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Marvel', @@ -29,7 +30,7 @@ module.exports = class CrushCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/cursed-sponge.js b/commands/edit-meme/cursed-sponge.js index 6661f02a..e43e5260 100644 --- a/commands/edit-meme/cursed-sponge.js +++ b/commands/edit-meme/cursed-sponge.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class CursedSpongeCommand extends Command { usages: 2, duration: 30 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelodeon', diff --git a/commands/edit-meme/dear-liberals.js b/commands/edit-meme/dear-liberals.js index ddb2e44a..5afea88d 100644 --- a/commands/edit-meme/dear-liberals.js +++ b/commands/edit-meme/dear-liberals.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class DearLiberalsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Turning Point USA', diff --git a/commands/edit-meme/deep-fry.js b/commands/edit-meme/deep-fry.js index 202cc4b0..f70c25ca 100644 --- a/commands/edit-meme/deep-fry.js +++ b/commands/edit-meme/deep-fry.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { desaturate, contrast } = require('../../util/Canvas'); @@ -14,12 +15,12 @@ module.exports = class DeepFryCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/demotivational.js b/commands/edit-meme/demotivational.js index e8a999af..1f14baaf 100644 --- a/commands/edit-meme/demotivational.js +++ b/commands/edit-meme/demotivational.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { shortenText, centerImagePart } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class DemotivationalCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -39,7 +40,7 @@ module.exports = class DemotivationalCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/dislike.js b/commands/edit-meme/dislike.js index 6a8a8425..a8a1ebcd 100644 --- a/commands/edit-meme/dislike.js +++ b/commands/edit-meme/dislike.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class DislikeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Bethesda', @@ -28,7 +29,7 @@ module.exports = class DislikeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/distracted-boyfriend.js b/commands/edit-meme/distracted-boyfriend.js index a31e5b58..4445c0a8 100644 --- a/commands/edit-meme/distracted-boyfriend.js +++ b/commands/edit-meme/distracted-boyfriend.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class DistractedBoyfriendCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Antonio Guillem', @@ -43,9 +44,9 @@ module.exports = class DistractedBoyfriendCommand extends Command { } async run(msg, { otherGirl, girlfriend, boyfriend }) { - const boyfriendAvatarURL = boyfriend.displayAvatarURL({ format: 'png', size: 256 }); - const girlfriendAvatarURL = girlfriend.displayAvatarURL({ format: 'png', size: 256 }); - const otherGirlAvatarURL = otherGirl.displayAvatarURL({ format: 'png', size: 256 }); + const boyfriendAvatarURL = boyfriend.displayAvatarURL({ extension: 'png', size: 256 }); + const girlfriendAvatarURL = girlfriend.displayAvatarURL({ extension: 'png', size: 256 }); + const otherGirlAvatarURL = otherGirl.displayAvatarURL({ extension: 'png', size: 256 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'distracted-boyfriend.png')); const boyfriendAvatarData = await request.get(boyfriendAvatarURL); const boyfriendAvatar = await loadImage(boyfriendAvatarData.body); diff --git a/commands/edit-meme/drakeposting.js b/commands/edit-meme/drakeposting.js index 35f71863..547093f6 100644 --- a/commands/edit-meme/drakeposting.js +++ b/commands/edit-meme/drakeposting.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class DrakepostingCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Drake', diff --git a/commands/edit-meme/edd-facts-book.js b/commands/edit-meme/edd-facts-book.js index 5478d4bb..486d4bf4 100644 --- a/commands/edit-meme/edd-facts-book.js +++ b/commands/edit-meme/edd-facts-book.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class EddFactsBookCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/enslaved.js b/commands/edit-meme/enslaved.js index d2ece1fe..5d19ae86 100644 --- a/commands/edit-meme/enslaved.js +++ b/commands/edit-meme/enslaved.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class EnslavedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -34,7 +35,7 @@ module.exports = class EnslavedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/food-broke.js b/commands/edit-meme/food-broke.js index 04f61e15..f6489571 100644 --- a/commands/edit-meme/food-broke.js +++ b/commands/edit-meme/food-broke.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class FoodBrokeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '@liltusk', @@ -36,7 +37,7 @@ module.exports = class FoodBrokeCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 128 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'food-broke.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-meme/for-five-hours.js b/commands/edit-meme/for-five-hours.js index dcddaa0f..aec456a6 100644 --- a/commands/edit-meme/for-five-hours.js +++ b/commands/edit-meme/for-five-hours.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class ForFiveHoursCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'NBC', @@ -28,7 +29,7 @@ module.exports = class ForFiveHoursCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/genie-rules.js b/commands/edit-meme/genie-rules.js index 09d1e845..3e06673e 100644 --- a/commands/edit-meme/genie-rules.js +++ b/commands/edit-meme/genie-rules.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class GenieRulesCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'u/Two-Tone-', diff --git a/commands/edit-meme/girl-worth-fighting-for.js b/commands/edit-meme/girl-worth-fighting-for.js index f8fe1c38..1bfac588 100644 --- a/commands/edit-meme/girl-worth-fighting-for.js +++ b/commands/edit-meme/girl-worth-fighting-for.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class GirlWorthFightingForCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Disney', @@ -35,7 +36,7 @@ module.exports = class GirlWorthFightingForCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/gru-plan.js b/commands/edit-meme/gru-plan.js index d642b2ea..39224791 100644 --- a/commands/edit-meme/gru-plan.js +++ b/commands/edit-meme/gru-plan.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -16,7 +17,7 @@ module.exports = class GruPlanCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Illumination', diff --git a/commands/edit-meme/i-cant-believe.js b/commands/edit-meme/i-cant-believe.js index df251d61..8d4eb26a 100644 --- a/commands/edit-meme/i-cant-believe.js +++ b/commands/edit-meme/i-cant-believe.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { firstUpperCase } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class ICantBelieveCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'I Can\'t Believe It\'s Not Butter!', diff --git a/commands/edit-meme/i-fear-no-man.js b/commands/edit-meme/i-fear-no-man.js index a8813ddd..518dee9b 100644 --- a/commands/edit-meme/i-fear-no-man.js +++ b/commands/edit-meme/i-fear-no-man.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class IFearNoManCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Valve', @@ -29,7 +30,7 @@ module.exports = class IFearNoManCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/if-those-kids-could-read.js b/commands/edit-meme/if-those-kids-could-read.js index 47bdb653..c1dd8976 100644 --- a/commands/edit-meme/if-those-kids-could-read.js +++ b/commands/edit-meme/if-those-kids-could-read.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class IfThoseKidsCouldReadCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '20th Century Fox', diff --git a/commands/edit-meme/kyon-gun.js b/commands/edit-meme/kyon-gun.js index 09abba5c..11cf97cb 100644 --- a/commands/edit-meme/kyon-gun.js +++ b/commands/edit-meme/kyon-gun.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class KyonGunCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'The Melancholy of Haruhi Suzumiya', @@ -33,7 +34,7 @@ module.exports = class KyonGunCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/like.js b/commands/edit-meme/like.js index 23c8aba8..addc245d 100644 --- a/commands/edit-meme/like.js +++ b/commands/edit-meme/like.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class LikeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Bethesda', @@ -28,7 +29,7 @@ module.exports = class LikeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/lisa-presentation.js b/commands/edit-meme/lisa-presentation.js index d72ada00..41ed8c37 100644 --- a/commands/edit-meme/lisa-presentation.js +++ b/commands/edit-meme/lisa-presentation.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class LisaPresentationCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '20th Century Fox', diff --git a/commands/edit-meme/look-at-this-photograph.js b/commands/edit-meme/look-at-this-photograph.js index 700bcf14..09078c9d 100644 --- a/commands/edit-meme/look-at-this-photograph.js +++ b/commands/edit-meme/look-at-this-photograph.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class LookAtThisPhotographCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelback', @@ -28,7 +29,7 @@ module.exports = class LookAtThisPhotographCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/look-what-karen-have.js b/commands/edit-meme/look-what-karen-have.js index beca8acf..1dd8710c 100644 --- a/commands/edit-meme/look-what-karen-have.js +++ b/commands/edit-meme/look-what-karen-have.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class LookWhatKarenHaveCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Know Your Meme', @@ -34,7 +35,7 @@ module.exports = class LookWhatKarenHaveCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/mario-bros-views.js b/commands/edit-meme/mario-bros-views.js index 9d7f6746..8cafb977 100644 --- a/commands/edit-meme/mario-bros-views.js +++ b/commands/edit-meme/mario-bros-views.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class MarioBrosViewsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nintendo', diff --git a/commands/edit-meme/meme-gen.js b/commands/edit-meme/meme-gen.js index c8a25105..7f0b5009 100644 --- a/commands/edit-meme/meme-gen.js +++ b/commands/edit-meme/meme-gen.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class MemeGenCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'ShareFonts.net', @@ -40,7 +41,7 @@ module.exports = class MemeGenCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/metamorphosis.js b/commands/edit-meme/metamorphosis.js index 2b7922a4..2bb56e16 100644 --- a/commands/edit-meme/metamorphosis.js +++ b/commands/edit-meme/metamorphosis.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class MetamorphosisCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -40,7 +41,7 @@ module.exports = class MetamorphosisCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/my-collection-grows.js b/commands/edit-meme/my-collection-grows.js index 81c7cec5..006365e4 100644 --- a/commands/edit-meme/my-collection-grows.js +++ b/commands/edit-meme/my-collection-grows.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class MyCollectionGrowsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nekopara', @@ -29,7 +30,7 @@ module.exports = class MyCollectionGrowsCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/new-password.js b/commands/edit-meme/new-password.js index 926f6191..876d91ca 100644 --- a/commands/edit-meme/new-password.js +++ b/commands/edit-meme/new-password.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { shortenText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class NewPasswordCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/nike-ad.js b/commands/edit-meme/nike-ad.js index 3a5385a4..7e30e3e5 100644 --- a/commands/edit-meme/nike-ad.js +++ b/commands/edit-meme/nike-ad.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class NikeAdCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nike', @@ -44,7 +45,7 @@ module.exports = class NikeAdCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/panik-kalm-panik.js b/commands/edit-meme/panik-kalm-panik.js index 3c55379a..b44ebfdb 100644 --- a/commands/edit-meme/panik-kalm-panik.js +++ b/commands/edit-meme/panik-kalm-panik.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class PanikKalmPanikCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/phoebe-teaching-joey.js b/commands/edit-meme/phoebe-teaching-joey.js index 4b8f3dd8..5ae72189 100644 --- a/commands/edit-meme/phoebe-teaching-joey.js +++ b/commands/edit-meme/phoebe-teaching-joey.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const coord = [ @@ -20,7 +21,7 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Warner Bros.', diff --git a/commands/edit-meme/pills.js b/commands/edit-meme/pills.js index cec19122..595af217 100644 --- a/commands/edit-meme/pills.js +++ b/commands/edit-meme/pills.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class PillsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/plankton-plan.js b/commands/edit-meme/plankton-plan.js index b79cf072..0805f756 100644 --- a/commands/edit-meme/plankton-plan.js +++ b/commands/edit-meme/plankton-plan.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -16,7 +17,7 @@ module.exports = class PlanktonPlanCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelodeon', diff --git a/commands/edit-meme/raw.js b/commands/edit-meme/raw.js index 3c642539..df23e2db 100644 --- a/commands/edit-meme/raw.js +++ b/commands/edit-meme/raw.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class RawCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Inside Scanlation', diff --git a/commands/edit-meme/reaction-meme.js b/commands/edit-meme/reaction-meme.js index 206f8e48..18b83d36 100644 --- a/commands/edit-meme/reaction-meme.js +++ b/commands/edit-meme/reaction-meme.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ReactionMemeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', @@ -32,7 +33,7 @@ module.exports = class ReactionMemeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/scroll-of-truth.js b/commands/edit-meme/scroll-of-truth.js index 82ddbefc..4b8fc4de 100644 --- a/commands/edit-meme/scroll-of-truth.js +++ b/commands/edit-meme/scroll-of-truth.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ScrollOfTruthCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Robotatertot', diff --git a/commands/edit-meme/sexy-singles.js b/commands/edit-meme/sexy-singles.js index 205fb9b4..a94c9f79 100644 --- a/commands/edit-meme/sexy-singles.js +++ b/commands/edit-meme/sexy-singles.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -17,12 +18,12 @@ module.exports = class SexySinglesCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 1024 }) } ] }); diff --git a/commands/edit-meme/skyrim-skill.js b/commands/edit-meme/skyrim-skill.js index d3f50133..f21caf15 100644 --- a/commands/edit-meme/skyrim-skill.js +++ b/commands/edit-meme/skyrim-skill.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class SkyrimSkillCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Bethesda', @@ -40,7 +41,7 @@ module.exports = class SkyrimSkillCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/sonic-says.js b/commands/edit-meme/sonic-says.js index 4e6e6b3f..ddfe03f9 100644 --- a/commands/edit-meme/sonic-says.js +++ b/commands/edit-meme/sonic-says.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class SonicSaysCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/sora-selfie.js b/commands/edit-meme/sora-selfie.js index 27ccbc3f..751a2b22 100644 --- a/commands/edit-meme/sora-selfie.js +++ b/commands/edit-meme/sora-selfie.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class SoraSelfieCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Square Enix', @@ -34,7 +35,7 @@ module.exports = class SoraSelfieCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/sos.js b/commands/edit-meme/sos.js index 1b2ebc2e..5f9b395c 100644 --- a/commands/edit-meme/sos.js +++ b/commands/edit-meme/sos.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -14,7 +15,7 @@ module.exports = class SosCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Esther Verkest', diff --git a/commands/edit-meme/spiderman-pointing.js b/commands/edit-meme/spiderman-pointing.js index ed90667b..014697f3 100644 --- a/commands/edit-meme/spiderman-pointing.js +++ b/commands/edit-meme/spiderman-pointing.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class SpidermanPointingCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Marvel', diff --git a/commands/edit-meme/spongebob-burn.js b/commands/edit-meme/spongebob-burn.js index e2f321ac..9799cd8a 100644 --- a/commands/edit-meme/spongebob-burn.js +++ b/commands/edit-meme/spongebob-burn.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class SpongebobBurnCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelodeon', diff --git a/commands/edit-meme/that-sign-wont-stop-me.js b/commands/edit-meme/that-sign-wont-stop-me.js index fd85e9b7..cc5f25ff 100644 --- a/commands/edit-meme/that-sign-wont-stop-me.js +++ b/commands/edit-meme/that-sign-wont-stop-me.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class ThatSignWontStopMeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'PBS Kids', diff --git a/commands/edit-meme/this-guy.js b/commands/edit-meme/this-guy.js index 2dc8b00a..46121763 100644 --- a/commands/edit-meme/this-guy.js +++ b/commands/edit-meme/this-guy.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ThisGuyCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Warner Bros.', @@ -29,7 +30,7 @@ module.exports = class ThisGuyCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/thug-life.js b/commands/edit-meme/thug-life.js index fba866f4..3e6134c3 100644 --- a/commands/edit-meme/thug-life.js +++ b/commands/edit-meme/thug-life.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ThugLifeCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'pngimg.com', @@ -29,7 +30,7 @@ module.exports = class ThugLifeCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/to-be-continued.js b/commands/edit-meme/to-be-continued.js index 21474384..4de23439 100644 --- a/commands/edit-meme/to-be-continued.js +++ b/commands/edit-meme/to-be-continued.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class ToBeContinuedCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'JoJo\'s Bizzare Adventure', @@ -28,7 +29,7 @@ module.exports = class ToBeContinuedCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-meme/tuxedo-pooh.js b/commands/edit-meme/tuxedo-pooh.js index 2f150e25..4ab41a8a 100644 --- a/commands/edit-meme/tuxedo-pooh.js +++ b/commands/edit-meme/tuxedo-pooh.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class TuxedoPoohCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Disney', diff --git a/commands/edit-meme/two-buttons.js b/commands/edit-meme/two-buttons.js index 7742aca2..e2866efd 100644 --- a/commands/edit-meme/two-buttons.js +++ b/commands/edit-meme/two-buttons.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -15,7 +16,7 @@ module.exports = class TwoButtonsCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/edit-meme/ugly.js b/commands/edit-meme/ugly.js index dd2a88f0..9060a643 100644 --- a/commands/edit-meme/ugly.js +++ b/commands/edit-meme/ugly.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class UglyCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Nickelodeon', @@ -29,7 +30,7 @@ module.exports = class UglyCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/ultimate-tattoo.js b/commands/edit-meme/ultimate-tattoo.js index 52e1aa10..2479b38c 100644 --- a/commands/edit-meme/ultimate-tattoo.js +++ b/commands/edit-meme/ultimate-tattoo.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class UltimateTattooCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Deathbulge', @@ -29,7 +30,7 @@ module.exports = class UltimateTattooCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 256 }) } ] }); diff --git a/commands/edit-meme/vietnam-flashbacks.js b/commands/edit-meme/vietnam-flashbacks.js index 80f21e4b..8ee92450 100644 --- a/commands/edit-meme/vietnam-flashbacks.js +++ b/commands/edit-meme/vietnam-flashbacks.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class VietnamFlashbacksCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Horst Faas', @@ -27,7 +28,7 @@ module.exports = class VietnamFlashbacksCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 2048 }) } ] }); diff --git a/commands/edit-meme/whiteboard.js b/commands/edit-meme/whiteboard.js index fd503fde..c07d724f 100644 --- a/commands/edit-meme/whiteboard.js +++ b/commands/edit-meme/whiteboard.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { wrapText } = require('../../util/Canvas'); @@ -14,7 +15,7 @@ module.exports = class WhiteboardCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'NBC', diff --git a/commands/edit-meme/worse-than-hitler.js b/commands/edit-meme/worse-than-hitler.js index 8e572998..97a3125c 100644 --- a/commands/edit-meme/worse-than-hitler.js +++ b/commands/edit-meme/worse-than-hitler.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -15,7 +16,7 @@ module.exports = class WorseThanHitlerCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '20th Century Fox', @@ -35,7 +36,7 @@ module.exports = class WorseThanHitlerCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); + const avatarURL = user.displayAvatarURL({ extension: 'png', size: 256 }); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'worse-than-hitler.png')); const { body } = await request.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/edit-meme/worthless.js b/commands/edit-meme/worthless.js index b307fb2a..9ffccdf7 100644 --- a/commands/edit-meme/worthless.js +++ b/commands/edit-meme/worthless.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const path = require('path'); @@ -16,7 +17,7 @@ module.exports = class WorthlessCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Disney', @@ -29,7 +30,7 @@ module.exports = class WorthlessCommand extends Command { { key: 'image', type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512 }) } ] }); diff --git a/commands/edit-text/embed.js b/commands/edit-text/embed.js index 92bbf619..ae401e38 100644 --- a/commands/edit-text/embed.js +++ b/commands/edit-text/embed.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); module.exports = class EmbedCommand extends Command { constructor(client) { @@ -8,7 +8,7 @@ module.exports = class EmbedCommand extends Command { group: 'edit-text', memberName: 'embed', description: 'Sends text in an embed.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], args: [ { key: 'text', @@ -19,6 +19,6 @@ module.exports = class EmbedCommand extends Command { } run(msg, { text }) { - return msg.embed(new MessageEmbed().setDescription(text)); + return msg.embed(new EmbedBuilder().setDescription(text)); } }; diff --git a/commands/edit-text/mocking.js b/commands/edit-text/mocking.js index a7f307c6..ac78d5dd 100644 --- a/commands/edit-text/mocking.js +++ b/commands/edit-text/mocking.js @@ -22,7 +22,7 @@ module.exports = class MockingCommand extends Command { run(msg, { text }) { const canEmoji = msg.guild - ? msg.channel.permissionsFor(this.client.user).has('USE_EXTERNAL_EMOJIS') + ? msg.channel.permissionsFor(this.client.user).has(PermissionFlagsBits.UseExternalEmojis) : true; const letters = text.split(''); for (let i = 0; i < letters.length; i += Math.floor(Math.random() * 4)) { diff --git a/commands/edit-text/translate.js b/commands/edit-text/translate.js index 85123a2d..3888e80a 100644 --- a/commands/edit-text/translate.js +++ b/commands/edit-text/translate.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const translate = require('@vitalets/google-translate-api'); const { list } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -14,7 +14,7 @@ module.exports = class TranslateCommand extends Command { memberName: 'translate', description: 'Translates text to a specific language.', details: `**Codes:** ${codes.join(', ')}`, - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Google', @@ -54,9 +54,9 @@ module.exports = class TranslateCommand extends Command { async run(msg, { text, target, base }) { const { text: result, from } = await translate(text, { to: target, from: base }); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x4285F4) - .setFooter('Powered by Google Translate', logos.googleTranslate) + .setFooter({ text: 'Powered by Google Translate', iconURL: logos.googleTranslate }) .addField(`❯ From: ${translate.languages[from.language.iso]}`, from.text.value || text) .addField(`❯ To: ${translate.languages[target]}`, result); return msg.embed(embed); diff --git a/commands/events/anime-airing.js b/commands/events/anime-airing.js index 03e20d4b..aebc216b 100644 --- a/commands/events/anime-airing.js +++ b/commands/events/anime-airing.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const moment = require('moment-timezone'); @@ -28,7 +29,7 @@ module.exports = class AnimeAiringCommand extends Command { group: 'events', memberName: 'anime-airing', description: 'Responds with a list of the anime that air today.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', diff --git a/commands/events/apod.js b/commands/events/apod.js index bf7f0854..a32ecf5c 100644 --- a/commands/events/apod.js +++ b/commands/events/apod.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { shorten } = require('../../util/Util'); const logos = require('../../assets/json/logos'); const { GOV_KEY } = process.env; @@ -13,7 +13,7 @@ module.exports = class ApodCommand extends Command { group: 'events', memberName: 'apod', description: 'Responds with today\'s Astronomy Picture of the Day.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'NASA', @@ -29,14 +29,18 @@ module.exports = class ApodCommand extends Command { const { body } = await request .get('https://api.nasa.gov/planetary/apod') .query({ api_key: GOV_KEY }); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(body.title) .setDescription(shorten(body.explanation)) .setColor(0x2E528E) - .setAuthor('Astronomy Picture of the Day', logos.nasa, 'https://apod.nasa.gov/apod/astropix.html') + .setAuthor({ + name: 'Astronomy Picture of the Day', + iconURL: logos.nasa, + url: 'https://apod.nasa.gov/apod/astropix.html' + }) .setImage(body.media_type === 'image' ? body.url : null) .setURL(body.url) - .setFooter(`Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}`) + .setFooter({ text: `Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}` }) .setTimestamp(); return msg.embed(embed); } diff --git a/commands/events/florida-man.js b/commands/events/florida-man.js index 500c8f14..c2c772ab 100644 --- a/commands/events/florida-man.js +++ b/commands/events/florida-man.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); const request = require('node-superfetch'); const cheerio = require('cheerio'); @@ -14,7 +15,7 @@ module.exports = class FloridaManCommand extends Command { group: 'events', memberName: 'florida-man', description: 'Responds with the Flordia man of the day.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'floridamanbirthday.org', diff --git a/commands/events/google-doodle.js b/commands/events/google-doodle.js index c80a374a..19f950c3 100644 --- a/commands/events/google-doodle.js +++ b/commands/events/google-doodle.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const moment = require('moment'); @@ -9,7 +10,7 @@ module.exports = class GoogleDoodleCommand extends Command { group: 'events', memberName: 'google-doodle', description: 'Responds with a Google Doodle, either the latest one or a random one from the past.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Google', diff --git a/commands/events/horoscope.js b/commands/events/horoscope.js index 44ba8348..60342b19 100644 --- a/commands/events/horoscope.js +++ b/commands/events/horoscope.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { firstUpperCase } = require('../../util/Util'); @@ -13,7 +13,7 @@ module.exports = class HoroscopeCommand extends Command { memberName: 'horoscope', description: 'Responds with today\'s horoscope for a specific Zodiac sign.', details: `**Signs:** ${signs.join(', ')}`, - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'astrology.TV', @@ -35,11 +35,11 @@ module.exports = class HoroscopeCommand extends Command { async run(msg, { sign }) { const horoscope = await this.fetchHoroscope(sign); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x9797FF) .setTitle(`Horoscope for ${firstUpperCase(sign)}...`) .setURL(`https://astrology.tv/horoscope/signs/${sign}/`) - .setFooter('© Kelli Fox, The Astrologer') + .setFooter({ text: '© Kelli Fox, The Astrologer' }) .setThumbnail(this.getImageURL(sign)) .setTimestamp() .setDescription(horoscope); diff --git a/commands/events/today-in-history.js b/commands/events/today-in-history.js index 281b7e76..f0f9afe3 100644 --- a/commands/events/today-in-history.js +++ b/commands/events/today-in-history.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { embedURL } = require('../../util/Util'); @@ -11,7 +11,7 @@ module.exports = class TodayInHistoryCommand extends Command { group: 'events', memberName: 'today-in-history', description: 'Responds with an event that occurred today in history.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'muffinlabs - Today in History', @@ -44,7 +44,7 @@ module.exports = class TodayInHistoryCommand extends Command { const body = JSON.parse(text); const events = body.data.Events; const event = events[Math.floor(Math.random() * events.length)]; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x9797FF) .setURL(body.url) .setTitle(`On this day (${body.date})...`) diff --git a/commands/games-mp/apples-to-apples.js b/commands/games-mp/apples-to-apples.js index 2286379d..4686d893 100644 --- a/commands/games-mp/apples-to-apples.js +++ b/commands/games-mp/apples-to-apples.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { Util: { escapeMarkdown } } = require('discord.js'); +const { escapeMarkdown, PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); const { shuffle } = require('../../util/Util'); const Game = require('../../structures/cards-against-humanity/Game'); @@ -15,7 +15,7 @@ module.exports = class ApplesToApplesCommand extends Command { description: 'Compete to see who can come up with the best card to match an adjective.', guildOnly: true, game: true, - clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'], + clientPermissions: [PermissionFlagsBits.AddReactions, 'READ_MESSAGE_HISTORY'], credit: [ { name: 'Mattel', diff --git a/commands/games-mp/car-race.js b/commands/games-mp/car-race.js index 315beb1b..e2720138 100644 --- a/commands/games-mp/car-race.js +++ b/commands/games-mp/car-race.js @@ -365,7 +365,7 @@ module.exports = class CarRaceCommand extends Command { userData.car = await loadImage( path.join(__dirname, '..', '..', 'assets', 'images', 'car-race', 'cars', `${car}.png`) ); - const userAvatar = await request.get(msg.author.displayAvatarURL({ format: 'png', size: 128 })); + const userAvatar = await request.get(msg.author.displayAvatarURL({ extension: 'png', size: 128 })); userData.avatar = await loadImage(userAvatar.body); let difficulty; const available = cars.filter(car2 => car !== car2); @@ -412,7 +412,7 @@ module.exports = class CarRaceCommand extends Command { ); } } - const oppoAvatar = await request.get(opponent.displayAvatarURL({ format: 'png', size: 128 })); + const oppoAvatar = await request.get(opponent.displayAvatarURL({ extension: 'png', size: 128 })); oppoData.avatar = await loadImage(oppoAvatar.body); let lastRoundWinner; let lastTurnTimeout = false; diff --git a/commands/games-mp/cards-against-humanity.js b/commands/games-mp/cards-against-humanity.js index 0dfdeb71..9c27116e 100644 --- a/commands/games-mp/cards-against-humanity.js +++ b/commands/games-mp/cards-against-humanity.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { Util: { escapeMarkdown } } = require('discord.js'); +const { escapeMarkdown, PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); const { shuffle } = require('../../util/Util'); const Game = require('../../structures/cards-against-humanity/Game'); @@ -16,7 +16,7 @@ module.exports = class CardsAgainstHumanityCommand extends Command { guildOnly: true, nsfw: true, game: true, - clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'], + clientPermissions: [PermissionFlagsBits.AddReactions, 'READ_MESSAGE_HISTORY'], credit: [ { name: 'Cards Against Humanity', diff --git a/commands/games-mp/imposter.js b/commands/games-mp/imposter.js index 84b59e1e..049e3f48 100644 --- a/commands/games-mp/imposter.js +++ b/commands/games-mp/imposter.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { stripIndents, oneLine } = require('common-tags'); const { Collection } = require('@discordjs/collection'); const { delay, awaitPlayers, list, reactIfAble } = require('../../util/Util'); @@ -15,7 +16,7 @@ module.exports = class ImposterCommand extends Command { description: 'Who is the imposter among us?', guildOnly: true, game: true, - clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'], + clientPermissions: [PermissionFlagsBits.AddReactions, 'READ_MESSAGE_HISTORY'], args: [ { key: 'playersCount', diff --git a/commands/games-sp/20-questions.js b/commands/games-sp/20-questions.js index 47ebe15b..f7e70a5d 100644 --- a/commands/games-sp/20-questions.js +++ b/commands/games-sp/20-questions.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageButton, MessageActionRow } = require('discord.js'); +const { ButtonBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { list } = require('../../util/Util'); @@ -37,9 +37,9 @@ module.exports = class TwentyQuestionsCommand extends Command { const startURL = await this.initialize(game); let question = await this.startGame(game, startURL); let win = null; - const initialRow = new MessageActionRow().addComponents( - new MessageButton().setCustomId('true').setLabel('Ready!').setStyle('PRIMARY'), - new MessageButton().setCustomId('false').setLabel('Nevermind').setStyle('SECONDARY') + const initialRow = new ActionRowBuilder().addComponents( + new ButtonBuilder().setCustomId('true').setLabel('Ready!').setStyle(ButtonStyle.Primary), + new ButtonBuilder().setCustomId('false').setLabel('Nevermind').setStyle(ButtonStyle.Secondary) ); const gameMsg = await msg.reply({ content: 'Welcome to 20 Questions! Think of something, and I will try to guess it.', @@ -61,16 +61,16 @@ module.exports = class TwentyQuestionsCommand extends Command { const answers = question.answers.map(answer => answer.text); const rowCount = Math.ceil(answers.length / 5); const rows = []; - for (let i = 0; i < rowCount; i++) rows.push(new MessageActionRow()); + for (let i = 0; i < rowCount; i++) rows.push(new ActionRowBuilder()); for (let i = 0; i < answers.length; i += 5) { const row = rows[Math.floor(i / 5)]; const components = answers.slice(i, i + 5); for (const component of components) { - row.addComponents(new MessageButton().setCustomId(component).setStyle('PRIMARY').setLabel(component)); + row.addComponents(new ButtonBuilder().setCustomId(component).setStyle(ButtonStyle.Primary).setLabel(component)); } } - const sRow = new MessageActionRow(); - sRow.addComponents(new MessageButton().setCustomId('end').setStyle('DANGER').setLabel('End')); + const sRow = new ActionRowBuilder(); + sRow.addComponents(new ButtonBuilder().setCustomId('end').setStyle(ButtonStyle.Danger).setLabel('End')); await buttonPress.editReply({ content: question.question, components: [...rows, sRow] diff --git a/commands/games-sp/akinator.js b/commands/games-sp/akinator.js index 550829eb..beb97691 100644 --- a/commands/games-sp/akinator.js +++ b/commands/games-sp/akinator.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, PermissionFlagsBits, ButtonStyle } = require('discord.js'); const { Aki, regions } = require('aki-api'); module.exports = class AkinatorCommand extends Command { @@ -11,7 +11,7 @@ module.exports = class AkinatorCommand extends Command { memberName: 'akinator', description: 'Think about a real or fictional character, I will try to guess who it is.', details: `**Regions:** ${regions.join(', ')}`, - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Akinator', @@ -39,9 +39,9 @@ module.exports = class AkinatorCommand extends Command { let guessResetNum = 0; let wentBack = false; let forceGuess = false; - const initialRow = new MessageActionRow().addComponents( - new MessageButton().setCustomId('true').setLabel('Ready!').setStyle('PRIMARY'), - new MessageButton().setCustomId('false').setLabel('Nevermind').setStyle('SECONDARY') + const initialRow = new ActionRowBuilder().addComponents( + new ButtonBuilder().setCustomId('true').setLabel('Ready!').setStyle(ButtonStyle.Primary), + new ButtonBuilder().setCustomId('false').setLabel('Nevermind').setStyle(ButtonStyle.Secondary) ); const gameMsg = await msg.reply({ content: 'Welcome to Akinator! Think of a character, and I will try to guess it.', @@ -74,15 +74,15 @@ module.exports = class AkinatorCommand extends Command { } } if (!aki.answers || aki.currentStep >= 79) forceGuess = true; - const row = new MessageActionRow(); + const row = new ActionRowBuilder(); for (const answer of aki.answers) { - row.addComponents(new MessageButton().setCustomId(answer).setStyle('PRIMARY').setLabel(answer)); + row.addComponents(new ButtonBuilder().setCustomId(answer).setStyle(ButtonStyle.Primary).setLabel(answer)); } - const sRow = new MessageActionRow(); + const sRow = new ActionRowBuilder(); if (aki.currentStep > 0) { - sRow.addComponents(new MessageButton().setCustomId('back').setStyle('SECONDARY').setLabel('Back')); + sRow.addComponents(new ButtonBuilder().setCustomId('back').setStyle(ButtonStyle.Secondary).setLabel('Back')); } - sRow.addComponents(new MessageButton().setCustomId('end').setStyle('DANGER').setLabel('End')); + sRow.addComponents(new ButtonBuilder().setCustomId('end').setStyle(ButtonStyle.Danger).setLabel('End')); await buttonPress.editReply({ content: `**${aki.currentStep + 1}.** ${aki.question} (${Math.round(Number.parseInt(aki.progress, 10))}%)`, components: [row, sRow], @@ -120,15 +120,15 @@ module.exports = class AkinatorCommand extends Command { break; } guessBlacklist.push(guess.id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xF78B26) .setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`) .setDescription(`${guess.name}${guess.description ? `\n_${guess.description}_` : ''}`) .setThumbnail(guess.absolute_picture_path || null) - .setFooter(forceGuess ? 'Final Guess' : `Guess ${timesGuessed}`); - const guessRow = new MessageActionRow().addComponents( - new MessageButton().setCustomId('true').setLabel('Yes').setStyle('SUCCESS'), - new MessageButton().setCustomId('false').setLabel('No').setStyle('DANGER') + .setFooter({ text: forceGuess ? 'Final Guess' : `Guess ${timesGuessed}` }); + const guessRow = new ActionRowBuilder().addComponents( + new ButtonBuilder().setCustomId('true').setLabel('Yes').setStyle(ButtonStyle.Success), + new ButtonBuilder().setCustomId('false').setLabel('No').setStyle(ButtonStyle.Danger) ); await buttonPress.editReply({ content: 'Is this your character?', @@ -155,9 +155,9 @@ module.exports = class AkinatorCommand extends Command { } } } - const row = new MessageActionRow(); + const row = new ActionRowBuilder(); row.addComponents( - new MessageButton().setLabel('Akinator Website').setStyle('LINK').setURL('https://akinator.com/') + new ButtonBuilder().setLabel('Akinator Website').setStyle(ButtonStyle.Link).setURL('https://akinator.com/') ); if (win === 'time') { return buttonPress.editReply({ content: 'I guess your silence means I have won.', components: [row] }); diff --git a/commands/games-sp/anime-score.js b/commands/games-sp/anime-score.js index 8d894ae4..01617a95 100644 --- a/commands/games-sp/anime-score.js +++ b/commands/games-sp/anime-score.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const logos = require('../../assets/json/logos'); @@ -45,7 +45,7 @@ module.exports = class AnimeScoreCommand extends Command { memberName: 'anime-score', description: 'See if you can guess what a random anime\'s score is.', game: true, - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', @@ -59,13 +59,13 @@ module.exports = class AnimeScoreCommand extends Command { async run(msg) { const anime = await this.getRandomAnime(msg.channel.nsfw); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x02A9FF) - .setAuthor('AniList', logos.anilist, 'https://anilist.co/') + .setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' }) .setImage(anime.coverImage.large || anime.coverImage.medium || null) .setTitle(anime.title.english || anime.title.romaji) .setDescription(`_${anime.startDate.year}, ${formats[anime.format]}_`) - .setFooter(anime.id.toString()); + .setFooter({ text: anime.id.toString() }); await msg.reply('**You have 15 seconds, what score do you think this anime has?**', { embeds: [embed] }); const filter = res => { if (res.author.id !== msg.author.id) return false; diff --git a/commands/games-sp/captcha.js b/commands/games-sp/captcha.js index dc9cdc86..124b3ed5 100644 --- a/commands/games-sp/captcha.js +++ b/commands/games-sp/captcha.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas } = require('canvas'); const pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'.split(''); @@ -14,7 +15,7 @@ module.exports = class CaptchaCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/games-sp/google-feud.js b/commands/games-sp/google-feud.js index 019a1660..2c119a30 100644 --- a/commands/games-sp/google-feud.js +++ b/commands/games-sp/google-feud.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const questions = require('../../assets/json/google-feud'); const { formatNumber } = require('../../util/Util'); @@ -75,18 +75,18 @@ module.exports = class GoogleFeudCommand extends Command { } makeEmbed(question, tries, suggestions, display) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x005AF0) .setTitle(`${question}...?`) .setDescription('Type the choice you think is a suggestion _without_ the question.') - .setFooter(`${tries} ${tries === 1 ? 'try' : 'tries'} remaining!`); + .setFooter({ text: `${tries} ${tries === 1 ? 'try' : 'tries'} remaining!` }); for (let i = 0; i < suggestions.length; i++) { const num = formatNumber(10000 - (i * 1000)); embed.addField(`❯ ${num}`, display[i], true); } if (suggestions.length % 3 !== 0 && suggestions.length > 3) { for (let i = 0; i < 3 - (suggestions.length % 3); i++) { - embed.addField('\u200B', '\u200B', true); + embed.addBlankField(true); } } return embed; diff --git a/commands/games-sp/guess-song.js b/commands/games-sp/guess-song.js index 13fd695e..8f0eced9 100644 --- a/commands/games-sp/guess-song.js +++ b/commands/games-sp/guess-song.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { Readable } = require('stream'); @@ -20,8 +21,8 @@ module.exports = class GuessSongCommand extends Command { duration: 15 }, guildOnly: true, - userPermissions: ['CONNECT', 'SPEAK'], - clientPermissions: ['ATTACH_FILES'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/games-sp/hearing-test.js b/commands/games-sp/hearing-test.js index 31f81315..c048e6b8 100644 --- a/commands/games-sp/hearing-test.js +++ b/commands/games-sp/hearing-test.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const { stripIndents } = require('common-tags'); const { delay, verify } = require('../../util/Util'); @@ -17,7 +18,7 @@ module.exports = class HearingTestCommand extends Command { duration: 10 }, guildOnly: true, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], game: true, credit: [ { diff --git a/commands/games-sp/horse-race.js b/commands/games-sp/horse-race.js index aa25c95e..183f89db 100644 --- a/commands/games-sp/horse-race.js +++ b/commands/games-sp/horse-race.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); const { stripIndents } = require('common-tags'); @@ -19,7 +20,7 @@ module.exports = class HorseRaceCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/games-sp/pokemon-advantage.js b/commands/games-sp/pokemon-advantage.js index 3e6da0e3..29d3038c 100644 --- a/commands/games-sp/pokemon-advantage.js +++ b/commands/games-sp/pokemon-advantage.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); @@ -18,7 +19,7 @@ module.exports = class PokemonAdvantageCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/games-sp/tarot.js b/commands/games-sp/tarot.js index aee2ca4e..6b2723eb 100644 --- a/commands/games-sp/tarot.js +++ b/commands/games-sp/tarot.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { Util: { escapeMarkdown } } = require('discord.js'); +const { escapeMarkdown } = require('discord.js'); const { stripIndents } = require('common-tags'); const { list, verify } = require('../../util/Util'); const TarotDeck = require('../../structures/tarot/TarotDeck'); diff --git a/commands/games-sp/true-or-false.js b/commands/games-sp/true-or-false.js index 0230d573..694eaf80 100644 --- a/commands/games-sp/true-or-false.js +++ b/commands/games-sp/true-or-false.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageActionRow, MessageButton } = require('discord.js'); +const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { stripIndents } = require('common-tags'); const request = require('node-superfetch'); const difficulties = ['easy', 'medium', 'hard']; @@ -45,9 +45,9 @@ module.exports = class TrueOrFalseCommand extends Command { if (!body.results) return msg.reply('Oh no, a question could not be fetched. Try again later!'); const correct = decodeURIComponent(body.results[0].correct_answer.toLowerCase()); const correctBool = correct === 'true'; - const row = new MessageActionRow().addComponents( - new MessageButton().setCustomId('true').setStyle('SUCCESS').setLabel('True'), - new MessageButton().setCustomId('false').setStyle('DANGER').setLabel('False') + const row = new ActionRowBuilder().addComponents( + new ButtonBuilder().setCustomId('true').setStyle(ButtonStyle.Success).setLabel('True'), + new ButtonBuilder().setCustomId('false').setStyle(ButtonStyle.Danger).setLabel('False') ); const questionMsg = await msg.reply(stripIndents` **You have 15 seconds to answer this question.** diff --git a/commands/games-sp/whos-that-pokemon-cry.js b/commands/games-sp/whos-that-pokemon-cry.js index 5ebd55c2..2ce34f5c 100644 --- a/commands/games-sp/whos-that-pokemon-cry.js +++ b/commands/games-sp/whos-that-pokemon-cry.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { reactIfAble } = require('../../util/Util'); module.exports = class WhosThatPokemonCryCommand extends Command { @@ -14,8 +15,8 @@ module.exports = class WhosThatPokemonCryCommand extends Command { duration: 10 }, guildOnly: true, - userPermissions: ['CONNECT', 'SPEAK'], - clientPermissions: ['ATTACH_FILES'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/games-sp/whos-that-pokemon.js b/commands/games-sp/whos-that-pokemon.js index 97dfe967..11b29038 100644 --- a/commands/games-sp/whos-that-pokemon.js +++ b/commands/games-sp/whos-that-pokemon.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); const { reactIfAble } = require('../../util/Util'); @@ -17,7 +18,7 @@ module.exports = class WhosThatPokemonCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], game: true, credit: [ { diff --git a/commands/info/avatar.js b/commands/info/avatar.js index b74b6fbd..d0450d4c 100644 --- a/commands/info/avatar.js +++ b/commands/info/avatar.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { embedURL } = require('../../util/Util'); const displayFmts = { jpg: 'JPEG', @@ -31,10 +31,10 @@ module.exports = class AvatarCommand extends Command { if (user.avatar) formats.push('jpg', 'webp'); const format = user.avatar && user.avatar.startsWith('a_') ? 'gif' : 'png'; if (format === 'gif') formats.push('gif'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(user.tag) .setDescription( - formats.map(fmt => embedURL(displayFmts[fmt], user.displayAvatarURL({ format: fmt, size: 2048 }))).join(' | ') + formats.map(fmt => embedURL(displayFmts[fmt], user.displayAvatarURL({ extension: fmt, size: 2048 }))).join(' | ') ) .setImage(user.displayAvatarURL({ format, size: 2048 })) .setColor(0x00AE86); diff --git a/commands/info/emoji-image.js b/commands/info/emoji-image.js index 10cd57af..552bf5a4 100644 --- a/commands/info/emoji-image.js +++ b/commands/info/emoji-image.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { GuildEmoji } = require('discord.js'); +const { GuildEmoji, PermissionFlagsBits } = require('discord.js'); const twemoji = require('twemoji-parser'); const request = require('node-superfetch'); const { createCanvas, loadImage } = require('canvas'); @@ -16,7 +16,7 @@ module.exports = class EmojiImageCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'emoji', diff --git a/commands/info/first-message.js b/commands/info/first-message.js index e906f825..e8ccd0dc 100644 --- a/commands/info/first-message.js +++ b/commands/info/first-message.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); module.exports = class FirstMessageCommand extends Command { constructor(client) { @@ -9,7 +9,7 @@ module.exports = class FirstMessageCommand extends Command { group: 'info', memberName: 'first-message', description: 'Responds with the first message ever sent to a channel.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], args: [ { key: 'channel', @@ -26,13 +26,13 @@ module.exports = class FirstMessageCommand extends Command { } const messages = await channel.messages.fetch({ after: 1, limit: 1 }); const message = messages.first(); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(message.member ? message.member.displayHexColor : 0x00AE86) - .setThumbnail(message.author.displayAvatarURL({ format: 'png', dynamic: true })) - .setAuthor(message.author.tag, message.author.displayAvatarURL({ format: 'png', dynamic: true })) + .setThumbnail(message.author.displayAvatarURL({ extension: 'png' })) + .setAuthor({ name: message.author.tag, iconURL: message.author.displayAvatarURL({ extension: 'png' }) }) .setDescription(message.content) .setTimestamp(message.createdAt) - .setFooter(`ID: ${message.id}`) + .setFooter({ text: `ID: ${message.id}` }) .addField('❯ Jump', `[Click Here to Jump](${message.url})`); return msg.embed(embed); } diff --git a/commands/info/server-icon.js b/commands/info/server-icon.js index 0034f9a0..f4be2c13 100644 --- a/commands/info/server-icon.js +++ b/commands/info/server-icon.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { embedURL } = require('../../util/Util'); const displayFmts = { jpg: 'JPEG', @@ -17,7 +17,7 @@ module.exports = class ServerIconCommand extends Command { memberName: 'server-icon', description: 'Responds with the server\'s icon.', guildOnly: true, - clientPermissions: ['EMBED_LINKS'] + clientPermissions: [PermissionFlagsBits.EmbedLinks] }); } @@ -26,10 +26,10 @@ module.exports = class ServerIconCommand extends Command { const formats = ['png', 'jpg', 'webp']; const format = msg.guild.icon && msg.guild.icon.startsWith('a_') ? 'gif' : 'png'; if (format === 'gif') formats.push('gif'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(msg.guild.name) .setDescription( - formats.map(fmt => embedURL(displayFmts[fmt], msg.guild.iconURL({ format: fmt, size: 2048 }))).join(' | ') + formats.map(fmt => embedURL(displayFmts[fmt], msg.guild.iconURL({ extension: fmt, size: 2048 }))).join(' | ') ) .setImage(msg.guild.iconURL({ format, size: 2048 })) .setColor(0x00AE86); diff --git a/commands/other/prune.js b/commands/other/prune.js index 90fa026b..506dc496 100644 --- a/commands/other/prune.js +++ b/commands/other/prune.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class PruneCommand extends Command { constructor(client) { @@ -13,8 +14,8 @@ module.exports = class PruneCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], - userPermissions: ['MANAGE_MESSAGES'], + clientPermissions: ['READ_MESSAGE_HISTORY', PermissionFlagsBits.ManageMessages], + userPermissions: [PermissionFlagsBits.ManageMessages], args: [ { key: 'count', diff --git a/commands/phone/phone-info.js b/commands/phone/phone-info.js index 29738bcb..4cb65027 100644 --- a/commands/phone/phone-info.js +++ b/commands/phone/phone-info.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = class PhoneInfoCommand extends Command { constructor(client) { @@ -20,11 +20,11 @@ module.exports = class PhoneInfoCommand extends Command { if (!call.active) return msg.reply('☎️ This call is not currently active.'); const otherChannel = msg.channel.id === call.origin.id ? call.recipient : call.origin; const otherChannelDM = msg.channel.id === call.origin.id ? false : !call.origin.guild; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x00AE86) .setThumbnail(otherChannelDM - ? call.startUser.displayAvatarURL({ format: 'png' }) - : otherChannel.guild.iconURL({ format: 'png' })) + ? call.startUser.displayAvatarURL({ extension: 'png' }) + : otherChannel.guild.iconURL({ extension: 'png' })) .addField('❯ Recipient Channel', otherChannelDM ? `@${call.startUser.tag}` : `#${otherChannel.name}`, true) .addField('❯ Recipient Server', otherChannelDM ? 'DM' : otherChannel.guild.name, true) .addField('❯ Recipient ID', otherChannel.id, true) diff --git a/commands/pokedex/pokedex-ability.js b/commands/pokedex/pokedex-ability.js index a62f8182..771f756e 100644 --- a/commands/pokedex/pokedex-ability.js +++ b/commands/pokedex/pokedex-ability.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); module.exports = class PokedexAbilityCommand extends Command { constructor(client) { @@ -9,7 +9,7 @@ module.exports = class PokedexAbilityCommand extends Command { group: 'pokedex', memberName: 'pokedex-ability', description: 'Searches the Pokédex for a Pokémon ability.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -34,7 +34,7 @@ module.exports = class PokedexAbilityCommand extends Command { async run(msg, { ability }) { const data = await this.client.pokemon.abilities.fetch(ability); if (!data) return msg.say('Could not find any results.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) .setTitle(data.name) .setDescription(data.description || 'No description available.'); diff --git a/commands/pokedex/pokedex-box-sprite.js b/commands/pokedex/pokedex-box-sprite.js index 5115e439..f8ccfc7b 100644 --- a/commands/pokedex/pokedex-box-sprite.js +++ b/commands/pokedex/pokedex-box-sprite.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { createCanvas } = require('canvas'); const { cropToContent } = require('../../util/Canvas'); @@ -31,7 +32,7 @@ module.exports = class PokedexBoxSpriteCommand extends Command { group: 'pokedex', memberName: 'pokedex-box-sprite', description: 'Responds with the box sprite of a Pokémon.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', diff --git a/commands/pokedex/pokedex-cry.js b/commands/pokedex/pokedex-cry.js index b075682c..c478bbc6 100644 --- a/commands/pokedex/pokedex-cry.js +++ b/commands/pokedex/pokedex-cry.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { reactIfAble } = require('../../util/Util'); module.exports = class PokedexCryCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class PokedexCryCommand extends Command { group: 'pokedex', memberName: 'pokedex-cry', description: 'Plays a Pokémon\'s cry.', - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], throttling: { usages: 2, duration: 10 diff --git a/commands/pokedex/pokedex-image.js b/commands/pokedex/pokedex-image.js index 505424d7..a2664371 100644 --- a/commands/pokedex/pokedex-image.js +++ b/commands/pokedex/pokedex-image.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class PokedexImageCommand extends Command { constructor(client) { @@ -18,7 +19,7 @@ module.exports = class PokedexImageCommand extends Command { group: 'pokedex', memberName: 'pokedex-image', description: 'Responds with the image of a Pokémon.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Pokémon', diff --git a/commands/pokedex/pokedex-item.js b/commands/pokedex/pokedex-item.js index ecee091f..e80237f9 100644 --- a/commands/pokedex/pokedex-item.js +++ b/commands/pokedex/pokedex-item.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); module.exports = class PokedexItemCommand extends Command { constructor(client) { @@ -9,7 +9,7 @@ module.exports = class PokedexItemCommand extends Command { group: 'pokedex', memberName: 'pokedex-item', description: 'Searches the Pokédex for a Pokémon item.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -34,7 +34,7 @@ module.exports = class PokedexItemCommand extends Command { async run(msg, { item }) { const data = await this.client.pokemon.items.fetch(item); if (!data) return msg.say('Could not find any results.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) .setTitle(data.name) .setDescription(data.description || 'No description available.') diff --git a/commands/pokedex/pokedex-location.js b/commands/pokedex/pokedex-location.js index 40f8a8a8..31b4fedb 100644 --- a/commands/pokedex/pokedex-location.js +++ b/commands/pokedex/pokedex-location.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const versions = require('../../assets/json/pokedex-location'); module.exports = class PokedexLocationCommand extends Command { @@ -20,7 +20,7 @@ module.exports = class PokedexLocationCommand extends Command { group: 'pokedex', memberName: 'pokedex-location', description: 'Responds with the location data for a Pokémon.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -61,9 +61,13 @@ module.exports = class PokedexLocationCommand extends Command { .map(location => `${location.name} (${location.versions.map(v => versions[v]).join('/')})`) .join('\n') : 'Location Unknown'; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) - .setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL) + .setAuthor({ + name: `#${pokemon.displayID} - ${pokemon.name}`, + iconURL: 'attachment://box.png', + url: pokemon.serebiiURL + }) .setDescription(desc) .setThumbnail(pokemon.spriteImageURL); return msg.channel.send({ diff --git a/commands/pokedex/pokedex-move.js b/commands/pokedex/pokedex-move.js index dd8aa47c..038ae823 100644 --- a/commands/pokedex/pokedex-move.js +++ b/commands/pokedex/pokedex-move.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); module.exports = class PokedexMoveCommand extends Command { constructor(client) { @@ -9,7 +9,7 @@ module.exports = class PokedexMoveCommand extends Command { group: 'pokedex', memberName: 'pokedex-move', description: 'Searches the Pokédex for a Pokémon move.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -34,7 +34,7 @@ module.exports = class PokedexMoveCommand extends Command { async run(msg, { move }) { const data = await this.client.pokemon.moves.fetch(move); if (!data) return msg.say('Could not find any results.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) .setTitle(data.name) .setDescription(data.description ? data.cleanDescription : 'No description available.') diff --git a/commands/pokedex/pokedex-moveset.js b/commands/pokedex/pokedex-moveset.js index 00c5a40f..5449fd0f 100644 --- a/commands/pokedex/pokedex-moveset.js +++ b/commands/pokedex/pokedex-moveset.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const versions = { 'red-blue': 'Red and Blue', 'ultra-sun-ultra-moon': 'Ultra Sun and Ultra Moon', @@ -25,7 +25,7 @@ module.exports = class PokedexMovesetCommand extends Command { group: 'pokedex', memberName: 'pokedex-moveset', description: 'Responds with the moveset for a Pokémon.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -61,12 +61,16 @@ module.exports = class PokedexMovesetCommand extends Command { async run(msg, { pokemon }) { if (!pokemon.gameDataCached) await pokemon.fetchGameData(); if (!pokemon.moveSet.length) return msg.say('This Pokémon\'s moves are not yet documented.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) - .setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL) + .setAuthor({ + name: `#${pokemon.displayID} - ${pokemon.name}`, + iconURL: 'attachment://box.png', + url: pokemon.serebiiURL + }) .setDescription(pokemon.moveSet.map(move => `**Level ${move.level}:** ${move.move.name}`).join('\n')) .setThumbnail(pokemon.spriteImageURL) - .setFooter(`Moveset data taken from ${versions[pokemon.moveSetVersion]}.`); + .setFooter({ text: `Moveset data taken from ${versions[pokemon.moveSetVersion]}.` }); return msg.channel.send({ embeds: [embed], files: [{ diff --git a/commands/pokedex/pokedex-stats.js b/commands/pokedex/pokedex-stats.js index 3f314eea..16deb5dd 100644 --- a/commands/pokedex/pokedex-stats.js +++ b/commands/pokedex/pokedex-stats.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); const { list } = require('../../util/Util'); @@ -11,7 +11,7 @@ module.exports = class PokedexCommand extends Command { group: 'pokedex', memberName: 'pokedex-stats', description: 'Responds with the stats for a Pokémon.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -75,13 +75,13 @@ module.exports = class PokedexCommand extends Command { spd: Math.round((variety.stats.spd / 255) * 10) * 2, total: Math.round((statTotal / 1125) * 10) * 2 }; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) - .setAuthor( - `#${pokemon.displayID} - ${pokemon.name}`, - 'attachment://box.png', - pokemon.serebiiURL - ) + .setAuthor({ + name: `#${pokemon.displayID} - ${pokemon.name}`, + iconURL: 'attachment://box.png', + url: pokemon.serebiiURL + }) .setThumbnail(pokemon.formSpriteImageURL(variety.id)) .addField(`❯ Base Stats (${variety.name || 'Normal'} Form)`, stripIndents` \`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${variety.stats.hp}** diff --git a/commands/pokedex/pokedex.js b/commands/pokedex/pokedex.js index 46c10f66..aae37a74 100644 --- a/commands/pokedex/pokedex.js +++ b/commands/pokedex/pokedex.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { stripIndents } = require('common-tags'); const { arrayEquals, reactIfAble, firstUpperCase } = require('../../util/Util'); const { MEGA_EVOLVE_EMOJI_NAME, MEGA_EVOLVE_EMOJI_ID } = process.env; @@ -24,7 +24,7 @@ module.exports = class PokedexCommand extends Command { group: 'pokedex', memberName: 'pokedex', description: 'Searches the Pokédex for a Pokémon.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -95,9 +95,13 @@ module.exports = class PokedexCommand extends Command { if (found.id === pokemon.id) return `**${found.name}**`; return found.name; }).join(' -> '); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) - .setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL) + .setAuthor({ + name: `#${pokemon.displayID} - ${pokemon.name}`, + iconURL: 'attachment://box.png', + url: pokemon.serebiiURL + }) .setDescription(stripIndents` **${pokemon.genus}** ${pokemon.entries.length ? pokemon.entries[Math.floor(Math.random() * pokemon.entries.length)] : 'No data.'} diff --git a/commands/pokedex/smogon.js b/commands/pokedex/smogon.js index 62eaba40..e3437158 100644 --- a/commands/pokedex/smogon.js +++ b/commands/pokedex/smogon.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const genGames = [null, 'rb', 'gs', 'rs', 'dp', 'bw', 'xy', 'sm', 'ss', 'sv']; const games = { rb: 'Red/Blue', @@ -21,7 +21,7 @@ module.exports = class SmogonCommand extends Command { group: 'pokedex', memberName: 'smogon', description: 'Responds with the Smogon tiers for a Pokémon.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Pokémon', @@ -62,16 +62,20 @@ module.exports = class SmogonCommand extends Command { async run(msg, { pokemon }) { const fetchGames = genGames.slice(pokemon.generation, pokemon.missingno ? 2 : genGames.length); if (!pokemon.missingno) await pokemon.fetchSmogonTiers(...fetchGames); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xED1C24) - .setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL) + .setAuthor({ + name: `#${pokemon.displayID} - ${pokemon.name}`, + iconURL: 'attachment://box.png', + url: pokemon.serebiiURL + }) .setThumbnail(pokemon.spriteImageURL); for (const game of fetchGames) { embed.addField(`❯ ${games[game]}`, `[${pokemon.smogonTiers[game].join('/')}](${pokemon.smogonURL(game)})`, true); } if (fetchGames.length % 3 !== 0 && fetchGames.length > 3) { for (let i = 0; i < 3 - (fetchGames.length % 3); i++) { - embed.addField('\u200B', '\u200B', true); + embed.addBlankField(true); } } return msg.channel.send({ diff --git a/commands/random-img/bird.js b/commands/random-img/bird.js index 27e223b9..4d6d1fb4 100644 --- a/commands/random-img/bird.js +++ b/commands/random-img/bird.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class BirdCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class BirdCommand extends Command { group: 'random-img', memberName: 'bird', description: 'Responds with a random image of a bird.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'shibe.online', diff --git a/commands/random-img/bunny.js b/commands/random-img/bunny.js index d33f4cb2..d23bbd90 100644 --- a/commands/random-img/bunny.js +++ b/commands/random-img/bunny.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const facts = require('../../assets/json/bunny-fact'); @@ -10,7 +11,7 @@ module.exports = class BunnyCommand extends Command { group: 'random-img', memberName: 'bunny', description: 'Responds with a random bunny image and fact.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'bunnies.io', diff --git a/commands/random-img/cat.js b/commands/random-img/cat.js index ea6c50f1..81c01a83 100644 --- a/commands/random-img/cat.js +++ b/commands/random-img/cat.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const facts = require('../../assets/json/cat-fact'); const { THECATAPI_KEY } = process.env; @@ -11,7 +12,7 @@ module.exports = class CatCommand extends Command { group: 'random-img', memberName: 'cat', description: 'Responds with a random cat image and fact.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'TheCatAPI', diff --git a/commands/random-img/dog.js b/commands/random-img/dog.js index 43a21acd..c0bca82a 100644 --- a/commands/random-img/dog.js +++ b/commands/random-img/dog.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const facts = require('../../assets/json/dog-fact'); const { THEDOGAPI_KEY } = process.env; @@ -11,7 +12,7 @@ module.exports = class DogCommand extends Command { group: 'random-img', memberName: 'dog', description: 'Responds with a random dog image and fact.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'TheDogAPI', diff --git a/commands/random-img/duck.js b/commands/random-img/duck.js index 6b934a78..fb46facf 100644 --- a/commands/random-img/duck.js +++ b/commands/random-img/duck.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class DuckCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class DuckCommand extends Command { group: 'random-img', memberName: 'duck', description: 'Responds with a random duck image.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Random-d.uk', diff --git a/commands/random-img/fox.js b/commands/random-img/fox.js index 9f5e525d..ec0627d4 100644 --- a/commands/random-img/fox.js +++ b/commands/random-img/fox.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class FoxCommand extends Command { @@ -8,7 +9,7 @@ module.exports = class FoxCommand extends Command { group: 'random-img', memberName: 'fox', description: 'Responds with a random fox image.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'RandomFox', diff --git a/commands/random-img/frog.js b/commands/random-img/frog.js index c46eae74..f750c022 100644 --- a/commands/random-img/frog.js +++ b/commands/random-img/frog.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class FrogCommand extends Command { constructor(client) { @@ -8,7 +9,7 @@ module.exports = class FrogCommand extends Command { group: 'random-img', memberName: 'frog', description: 'Responds with a random frog image.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'FROGLAND!', diff --git a/commands/random-img/goose.js b/commands/random-img/goose.js index e76f774f..1c868f86 100644 --- a/commands/random-img/goose.js +++ b/commands/random-img/goose.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class GooseCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class GooseCommand extends Command { group: 'random-img', memberName: 'goose', description: 'Responds with a random goose image.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'nekos.life', diff --git a/commands/random-img/inspiration.js b/commands/random-img/inspiration.js index 945d7d8c..50aacb77 100644 --- a/commands/random-img/inspiration.js +++ b/commands/random-img/inspiration.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class InspirationCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class InspirationCommand extends Command { group: 'random-img', memberName: 'inspiration', description: 'Responds with a randomly generated inspiration.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'InspiroBot', diff --git a/commands/random-img/lizard.js b/commands/random-img/lizard.js index 960d139f..fa58ac0b 100644 --- a/commands/random-img/lizard.js +++ b/commands/random-img/lizard.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class LizardCommand extends Command { @@ -8,7 +9,7 @@ module.exports = class LizardCommand extends Command { group: 'random-img', memberName: 'lizard', description: 'Responds with a random lizard image.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'nekos.life', diff --git a/commands/random-img/lorem-picsum.js b/commands/random-img/lorem-picsum.js index f730febd..f71adb2a 100644 --- a/commands/random-img/lorem-picsum.js +++ b/commands/random-img/lorem-picsum.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class LoremPicsumCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class LoremPicsumCommand extends Command { group: 'random-img', memberName: 'lorem-picsum', description: 'Responds with a random image of a certain size.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Lorem Picsum', diff --git a/commands/random-img/shiba.js b/commands/random-img/shiba.js index 0ed3dfe8..0c941fd9 100644 --- a/commands/random-img/shiba.js +++ b/commands/random-img/shiba.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class ShibaCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class ShibaCommand extends Command { group: 'random-img', memberName: 'shiba', description: 'Responds with a random image of a Shiba Inu.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'shibe.online', diff --git a/commands/random-img/xiao.js b/commands/random-img/xiao.js index 34a5e657..0a8fd0cc 100644 --- a/commands/random-img/xiao.js +++ b/commands/random-img/xiao.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const sagiri = require('sagiri'); const { SAUCENAO_KEY } = process.env; const sagiriClient = sagiri(SAUCENAO_KEY); @@ -15,7 +16,7 @@ module.exports = class XiaoCommand extends Command { group: 'random-img', memberName: 'xiao', description: 'Responds with a random image of Xiao Pai.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Marvelous', diff --git a/commands/random-seed/friendship.js b/commands/random-seed/friendship.js index e8379624..5e4a67fa 100644 --- a/commands/random-seed/friendship.js +++ b/commands/random-seed/friendship.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { MersenneTwister19937, integer } = require('random-js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -22,7 +23,7 @@ module.exports = class FriendshipCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Attype Studio', @@ -63,8 +64,8 @@ module.exports = class FriendshipCommand extends Command { const random = MersenneTwister19937.seed(calculated); level = integer(0, 100)(random); } - const firstAvatarURL = first.displayAvatarURL({ format: 'png', size: 512 }); - const secondAvatarURL = second.displayAvatarURL({ format: 'png', size: 512 }); + const firstAvatarURL = first.displayAvatarURL({ extension: 'png', size: 512 }); + const secondAvatarURL = second.displayAvatarURL({ extension: 'png', size: 512 }); const firstAvatarData = await request.get(firstAvatarURL); const firstAvatar = await loadImage(firstAvatarData.body); const secondAvatarData = await request.get(secondAvatarURL); diff --git a/commands/random-seed/ship.js b/commands/random-seed/ship.js index 9db8b122..d78e2e86 100644 --- a/commands/random-seed/ship.js +++ b/commands/random-seed/ship.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { MersenneTwister19937, integer } = require('random-js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -23,7 +24,7 @@ module.exports = class ShipCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Attype Studio', @@ -66,8 +67,8 @@ module.exports = class ShipCommand extends Command { const random = MersenneTwister19937.seed(calculated); level = integer(0, 100)(random); } - const firstAvatarURL = first.displayAvatarURL({ format: 'png', size: 512 }); - const secondAvatarURL = second.displayAvatarURL({ format: 'png', size: 512 }); + const firstAvatarURL = first.displayAvatarURL({ extension: 'png', size: 512 }); + const secondAvatarURL = second.displayAvatarURL({ extension: 'png', size: 512 }); const firstAvatarData = await request.get(firstAvatarURL); const firstAvatar = await loadImage(firstAvatarData.body); const secondAvatarData = await request.get(secondAvatarURL); diff --git a/commands/random-seed/think-of.js b/commands/random-seed/think-of.js index b88b3589..bcdf3c87 100644 --- a/commands/random-seed/think-of.js +++ b/commands/random-seed/think-of.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { MersenneTwister19937, integer } = require('random-js'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); @@ -18,7 +19,7 @@ module.exports = class ThinkOfCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Attype Studio', @@ -60,8 +61,8 @@ module.exports = class ThinkOfCommand extends Command { const random = MersenneTwister19937.seed(calculated); thought = thoughts[integer(0, thoughts.length - 1)(random)]; } - const firstAvatarURL = first.displayAvatarURL({ format: 'png', size: 512 }); - const secondAvatarURL = second.displayAvatarURL({ format: 'png', size: 512 }); + const firstAvatarURL = first.displayAvatarURL({ extension: 'png', size: 512 }); + const secondAvatarURL = second.displayAvatarURL({ extension: 'png', size: 512 }); const firstAvatarData = await request.get(firstAvatarURL); const firstAvatar = await loadImage(firstAvatarData.body); const secondAvatarData = await request.get(secondAvatarURL); diff --git a/commands/search/anilist.js b/commands/search/anilist.js index ab275ceb..f012c71a 100644 --- a/commands/search/anilist.js +++ b/commands/search/anilist.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const searchGraphQL = stripIndents` @@ -20,7 +21,7 @@ module.exports = class AnilistCommand extends Command { group: 'search', memberName: 'anilist', description: 'Responds with user information for an Anilist user.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', diff --git a/commands/search/anime-character.js b/commands/search/anime-character.js index 5b19da4a..051cf136 100644 --- a/commands/search/anime-character.js +++ b/commands/search/anime-character.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util'); @@ -53,7 +53,7 @@ module.exports = class AnimeCharacterCommand extends Command { group: 'search', memberName: 'anime-character', description: 'Searches AniList for your query, getting character results.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', @@ -75,9 +75,9 @@ module.exports = class AnimeCharacterCommand extends Command { const id = await this.search(query); if (!id) return msg.say('Could not find any results.'); const character = await this.fetchCharacter(id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x02A9FF) - .setAuthor('AniList', logos.anilist, 'https://anilist.co/') + .setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' }) .setURL(character.siteUrl) .setThumbnail(character.image.large || character.image.medium || null) .setTitle(`${character.name.first || ''}${character.name.last ? ` ${character.name.last}` : ''}`) diff --git a/commands/search/anime-staff.js b/commands/search/anime-staff.js index 7b605db6..2a9f6ee9 100644 --- a/commands/search/anime-staff.js +++ b/commands/search/anime-staff.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util'); @@ -73,7 +73,7 @@ module.exports = class AnimeStaffCommand extends Command { group: 'search', memberName: 'anime-staff', description: 'Searches AniList for your query, getting staff results.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', @@ -95,9 +95,9 @@ module.exports = class AnimeStaffCommand extends Command { const id = await this.search(query); if (!id) return msg.say('Could not find any results.'); const staff = await this.fetchStaff(id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x02A9FF) - .setAuthor('AniList', logos.anilist, 'https://anilist.co/') + .setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' }) .setURL(staff.siteUrl) .setThumbnail(staff.image.large || staff.image.medium || null) .setTitle(`${staff.name.first || ''}${staff.name.last ? ` ${staff.name.last}` : ''}`) diff --git a/commands/search/anime.js b/commands/search/anime.js index 8f772fc7..0b75316f 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { stripIndents } = require('common-tags'); @@ -85,7 +85,7 @@ module.exports = class AnimeCommand extends Command { group: 'search', memberName: 'anime', description: 'Searches AniList for your query, getting anime results.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', @@ -118,9 +118,9 @@ module.exports = class AnimeCommand extends Command { const entry = this.personalList.find(ani => ani.mediaId === id); const malScore = await this.fetchMALScore(anime.idMal); const malURL = `https://myanimelist.net/anime/${anime.idMal}`; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x02A9FF) - .setAuthor('AniList', logos.anilist, 'https://anilist.co/') + .setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' }) .setURL(anime.siteUrl) .setThumbnail(anime.coverImage.large || anime.coverImage.medium || null) .setTitle(anime.title.english || anime.title.romaji) diff --git a/commands/search/github.js b/commands/search/github.js index 9bc42106..52c9ebbc 100644 --- a/commands/search/github.js +++ b/commands/search/github.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const moment = require('moment'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -14,7 +14,7 @@ module.exports = class GithubCommand extends Command { group: 'search', memberName: 'github', description: 'Responds with information on a GitHub repository.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'GitHub', @@ -43,9 +43,9 @@ module.exports = class GithubCommand extends Command { const { body } = await request .get(`https://api.github.com/repos/${author}/${repository}`) .set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` }); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xFFFFFF) - .setAuthor('GitHub', logos.github, 'https://github.com/') + .setAuthor({ name: 'GitHub', iconURL: logos.github, url: 'https://github.com/' }) .setTitle(body.full_name) .setURL(body.html_url) .setDescription(body.description ? shorten(body.description) : 'No description.') diff --git a/commands/search/gravatar.js b/commands/search/gravatar.js index 47f3dbd6..d1d8149f 100644 --- a/commands/search/gravatar.js +++ b/commands/search/gravatar.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { hash } = require('../../util/Util'); @@ -9,7 +10,7 @@ module.exports = class GravatarCommand extends Command { group: 'search', memberName: 'gravatar', description: 'Responds with the Gravatar for an email.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Gravatar', diff --git a/commands/search/http-cat.js b/commands/search/http-cat.js index 9079b825..22221ded 100644 --- a/commands/search/http-cat.js +++ b/commands/search/http-cat.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); module.exports = class HttpCatCommand extends Command { @@ -8,7 +9,7 @@ module.exports = class HttpCatCommand extends Command { group: 'search', memberName: 'http-cat', description: 'Responds with a cat for an HTTP status code.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'HTTP Cats', diff --git a/commands/search/know-your-meme.js b/commands/search/know-your-meme.js index eb166947..62dea6dc 100644 --- a/commands/search/know-your-meme.js +++ b/commands/search/know-your-meme.js @@ -1,7 +1,7 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); const cheerio = require('cheerio'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { shorten } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -13,7 +13,7 @@ module.exports = class KnowYourMemeCommand extends Command { group: 'search', memberName: 'know-your-meme', description: 'Searches Know Your Meme for your query.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Know Your Meme', @@ -34,9 +34,9 @@ module.exports = class KnowYourMemeCommand extends Command { const location = await this.search(query); if (!location) return msg.say('Could not find any results.'); const data = await this.fetchMeme(location); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x12133F) - .setAuthor('Know Your Meme', logos.kym, 'https://knowyourmeme.com/') + .setAuthor({ name: 'Know Your Meme', iconURL: logos.kym, url: 'https://knowyourmeme.com/' }) .setTitle(data.name) .setDescription(shorten(data.description || 'No description available.')) .setURL(data.url) diff --git a/commands/search/lorcana.js b/commands/search/lorcana.js index ce5514a2..08b5ed9f 100644 --- a/commands/search/lorcana.js +++ b/commands/search/lorcana.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const logos = require('../../assets/json/logos'); module.exports = class LorcanaCommand extends Command { @@ -40,17 +40,17 @@ module.exports = class LorcanaCommand extends Command { if (!card) return msg.say('Could not find any results.'); const oracleText = card.Body_Text ? card.Body_Text.replace(/{i}/g, 'Ink') : `_${card.Flavor_Text}_`; const classifications = card.Classifications ? `- ${card.Classifications}` : ''; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setURL(card.Image) .setColor(0xD3B078) .setThumbnail(card.Image) .setDescription(`{${card.Cost}} ${card.Type}${classifications}\n\n${oracleText}`) - .setAuthor('Lorcana', logos.lorcana, 'https://www.disneylorcana.com/en-US') + .setAuthor({ name: 'Lorcana', iconURL: logos.lorcana, url: 'https://www.disneylorcana.com/en-US' }) .setTitle(card.Name) - .setFooter(`${card.Set_Name} - ${card.Card_Num}`) + .setFooter({ text: `${card.Set_Name} - ${card.Card_Num}` }) .addField('❯ Color', card.Color, true) .addField('❯ Inkable?', card.Inkable ? 'Yes' : 'No', true) - .addField('\u200B', '\u200B', true); + .addBlankField(true); if (card.Type === 'Character') { embed.addField('❯ Strength', card.Strength.toString(), true); embed.addField('❯ Willpower', card.Willpower.toString(), true); diff --git a/commands/search/magic.js b/commands/search/magic.js index bb48af13..fc118959 100644 --- a/commands/search/magic.js +++ b/commands/search/magic.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { stripIndents } = require('common-tags'); const logos = require('../../assets/json/logos'); @@ -59,17 +59,17 @@ module.exports = class MagicCommand extends Command { const isMDFC = Boolean(card.card_faces); const oracleText = isMDFC ? card.card_faces.map(c => c.oracle_text).join('\n\n//\n\n') : card.oracle_text; const manaCost = isMDFC ? card.card_faces.map(c => c.mana_cost).join(' // ') : card.mana_cost; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setURL(card.scryfall_uri) .setColor(0x2B253A) .setThumbnail(card.card_faces ? card.card_faces[0].image_uris.art_crop : card.image_uris.art_crop) .setDescription(`${manaCost} ${card.type_line}\n\n${oracleText}`) - .setAuthor('Scryfall', logos.scryfall, 'https://scryfall.com/') + .setAuthor({ name: 'Scryfall', iconURL: logos.scryfall, url: 'https://scryfall.com/' }) .setTitle(card.name); if (card.power && card.toughness) { embed.addField('❯ Power', card.power, true); embed.addField('❯ Toughness', card.toughness, true); - embed.addField('\u200B', '\u200B', true); + embed.addBlankField(true); } if (card.loyalty) { embed.addField('❯ Loyalty', card.loyalty); diff --git a/commands/search/manga.js b/commands/search/manga.js index 07d3c392..1ade483e 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { stripIndents } = require('common-tags'); @@ -78,7 +78,7 @@ module.exports = class MangaCommand extends Command { group: 'search', memberName: 'manga', description: 'Searches AniList for your query, getting manga results.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'AniList', @@ -111,9 +111,9 @@ module.exports = class MangaCommand extends Command { const entry = this.personalList.find(ma => ma.mediaId === id); const malScore = await this.fetchMALScore(manga.idMal); const malURL = `https://myanimelist.net/manga/${manga.idMal}`; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x02A9FF) - .setAuthor('AniList', logos.anilist, 'https://anilist.co/') + .setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' }) .setURL(manga.siteUrl) .setThumbnail(manga.coverImage.large || manga.coverImage.medium || null) .setTitle(manga.title.english || manga.title.romaji) diff --git a/commands/search/nasa.js b/commands/search/nasa.js index 3460f4cc..cc49e4c2 100644 --- a/commands/search/nasa.js +++ b/commands/search/nasa.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { shorten, embedURL } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -11,7 +11,7 @@ module.exports = class NASACommand extends Command { group: 'search', memberName: 'nasa', description: 'Searches NASA\'s image archive for your query.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'NASA', @@ -39,13 +39,13 @@ module.exports = class NASACommand extends Command { const images = body.collection.items; if (!images.length) return msg.say('Could not find any results.'); const data = images[Math.floor(Math.random() * images.length)]; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(shorten(data.data[0].title, 256)) .setDescription(shorten(this.cleanHTML(data.data[0].description))) .setColor(0x2E528E) - .setAuthor('NASA', logos.nasa, 'https://www.nasa.gov/multimedia/imagegallery/index.html') + .setAuthor({ name: 'NASA', iconURL: logos.nasa, url: 'https://www.nasa.gov/multimedia/imagegallery/index.html' }) .setImage(`https://images-assets.nasa.gov/image/${data.data[0].nasa_id}/${data.data[0].nasa_id}~thumb.jpg`) - .setFooter(`Image Credits: ${data.data[0].center || 'Public Domain'}`) + .setFooter({ text: `Image Credits: ${data.data[0].center || 'Public Domain'}` }) .setTimestamp(new Date(data.data[0].date_created)); return msg.embed(embed); } diff --git a/commands/search/neopets-item.js b/commands/search/neopets-item.js index 7efbda69..d4acc45c 100644 --- a/commands/search/neopets-item.js +++ b/commands/search/neopets-item.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { formatNumber } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -12,7 +12,7 @@ module.exports = class NeopetsItemCommand extends Command { group: 'search', memberName: 'neopets-item', description: 'Responds with information on a specific Neopets item.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Neopets', @@ -37,9 +37,9 @@ module.exports = class NeopetsItemCommand extends Command { async run(msg, { item }) { const data = await this.fetchItem(item); if (!data) return msg.say('Could not find any results.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xFFCE31) - .setAuthor('Neopets', logos.neopets, 'http://www.neopets.com/') + .setAuthor({ name: 'Neopets', iconURL: logos.neopets, url: 'http://www.neopets.com/' }) .setTitle(data.name) .setDescription(data.details) .setURL(data.url) diff --git a/commands/search/npm.js b/commands/search/npm.js index 31d43545..c2295d0c 100644 --- a/commands/search/npm.js +++ b/commands/search/npm.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const moment = require('moment'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { trimArray } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -12,7 +12,7 @@ module.exports = class NPMCommand extends Command { group: 'search', memberName: 'npm', description: 'Responds with information on an NPM package.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'npm', @@ -38,9 +38,9 @@ module.exports = class NPMCommand extends Command { const version = body.versions[body['dist-tags'].latest]; const maintainers = trimArray(body.maintainers.map(user => user.name)); const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xCB0000) - .setAuthor('NPM', logos.npm, 'https://www.npmjs.com/') + .setAuthor({ name: 'NPM', iconURL: logos.npm, url: 'https://www.npmjs.com/' }) .setTitle(body.name) .setURL(`https://www.npmjs.com/package/${pkg}`) .setDescription(body.description || 'No description.') diff --git a/commands/search/periodic-table.js b/commands/search/periodic-table.js index e74261ad..1c2c5c9a 100644 --- a/commands/search/periodic-table.js +++ b/commands/search/periodic-table.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { createCanvas, loadImage } = require('canvas'); const path = require('path'); @@ -28,7 +29,7 @@ module.exports = class PeriodicTableCommand extends Command { usages: 2, duration: 10 }, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'Bowserinator', diff --git a/commands/search/urban.js b/commands/search/urban.js index b48c7e59..c1e5a506 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -12,7 +12,7 @@ module.exports = class UrbanCommand extends Command { group: 'search', memberName: 'urban', description: 'Defines a word, but with Urban Dictionary.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Urban Dictionary', @@ -36,13 +36,13 @@ module.exports = class UrbanCommand extends Command { .query({ term: word }); if (!body.list.length) return msg.say('Could not find any results.'); const data = body.list[0]; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x32A8F0) - .setAuthor('Urban Dictionary', logos.urban, 'https://www.urbandictionary.com/') + .setAuthor({ name: 'Urban Dictionary', iconURL: logos.urban, url: 'https://www.urbandictionary.com/' }) .setURL(data.permalink) .setTitle(data.word) .setDescription(shorten(data.definition.replace(/\[|\]/g, ''))) - .setFooter(`👍 ${formatNumber(data.thumbs_up)} 👎 ${formatNumber(data.thumbs_down)}`) + .setFooter({ text: `👍 ${formatNumber(data.thumbs_up)} 👎 ${formatNumber(data.thumbs_down)}` }) .setTimestamp(new Date(data.written_on)) .addField('❯ Example', data.example ? shorten(data.example.replace(/\[|\]/g, ''), 1000) : 'None'); return msg.embed(embed); diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index ec07d294..d8c5bced 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -11,7 +11,7 @@ module.exports = class WikipediaCommand extends Command { group: 'search', memberName: 'wikipedia', description: 'Searches Wikipedia for your query.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Wikipedia', @@ -44,10 +44,10 @@ module.exports = class WikipediaCommand extends Command { }); const data = body.query.pages[0]; if (data.missing) return msg.say('Could not find any results.'); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xE7E7E7) .setTitle(data.title) - .setAuthor('Wikipedia', logos.wikipedia, 'https://www.wikipedia.org/') + .setAuthor({ name: 'Wikipedia', iconURL: logos.wikipedia, url: 'https://www.wikipedia.org/' }) .setURL(`https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`) .setDescription(shorten(data.extract.replaceAll('\n', '\n\n'))); return msg.embed(embed); diff --git a/commands/search/xkcd.js b/commands/search/xkcd.js index 159d1d13..c82892e4 100644 --- a/commands/search/xkcd.js +++ b/commands/search/xkcd.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const types = ['random', 'today']; @@ -11,7 +11,7 @@ module.exports = class XKCDCommand extends Command { group: 'search', memberName: 'xkcd', description: 'Responds with an XKCD comic, either today\'s, a random one, or a specific one.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'xkcd', @@ -40,34 +40,34 @@ module.exports = class XKCDCommand extends Command { async run(msg, { query }) { const current = await request.get('https://xkcd.com/info.0.json'); if (query === 'today') { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${current.body.num} - ${current.body.title}`) .setColor(0x9797FF) .setURL(`https://xkcd.com/${current.body.num}`) .setImage(current.body.img) - .setFooter(current.body.alt); + .setFooter({ text: current.body.alt }); return msg.embed(embed); } if (query === 'random') { const random = Math.floor(Math.random() * current.body.num) + 1; const { body } = await request.get(`https://xkcd.com/${random}/info.0.json`); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${body.num} - ${body.title}`) .setColor(0x9797FF) .setURL(`https://xkcd.com/${body.num}`) .setImage(body.img) - .setFooter(body.alt); + .setFooter({ text: body.alt }); return msg.embed(embed); } const choice = Number.parseInt(query, 10); if (current.body.num < choice) return msg.say('Could not find any results.'); const { body } = await request.get(`https://xkcd.com/${choice}/info.0.json`); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${body.num} - ${body.title}`) .setColor(0x9797FF) .setURL(`https://xkcd.com/${body.num}`) .setImage(body.img) - .setFooter(body.alt); + .setFooter({ text: body.alt }); return msg.embed(embed); } }; diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index 8995ece9..624fd82e 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const logos = require('../../assets/json/logos'); @@ -12,7 +12,7 @@ module.exports = class YuGiOhCommand extends Command { group: 'search', memberName: 'yu-gi-oh', description: 'Responds with info on a Yu-Gi-Oh! card.', - clientPermissions: ['EMBED_LINKS'], + clientPermissions: [PermissionFlagsBits.EmbedLinks], credit: [ { name: 'Konami', @@ -45,14 +45,14 @@ module.exports = class YuGiOhCommand extends Command { la: 'english' }); const data = body.data[0]; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0xBE5F1F) .setTitle(data.name) .setURL(`https://db.ygoprodeck.com/card/?search=${data.id}`) .setDescription(data.type === 'Normal Monster' ? `_${shorten(data.desc)}_` : shorten(data.desc)) - .setAuthor('Yu-Gi-Oh!', logos.yugioh, 'http://www.yugioh-card.com/') + .setAuthor({ name: 'Yu-Gi-Oh!', iconURL: logos.yugioh, url: 'http://www.yugioh-card.com/' }) .setThumbnail(data.card_images[0].image_url) - .setFooter(data.id.toString()) + .setFooter({ text: data.id.toString() }) .addField('❯ Type', data.type, true) .addField(data.type.includes('Monster') ? '❯ Race' : '❯ Spell Type', data.race, true); if (data.type.includes('Monster')) { diff --git a/commands/single/cave.js b/commands/single/cave.js index 7419591f..ac406f54 100644 --- a/commands/single/cave.js +++ b/commands/single/cave.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const types = ['default', 'steve']; @@ -11,7 +12,7 @@ module.exports = class CaveCommand extends Command { memberName: 'cave', description: 'Sends a Minecraft cave that blends in with the chat.', details: `**Types:** ${types.join(', ')}`, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], args: [ { key: 'type', diff --git a/commands/single/dark-light.js b/commands/single/dark-light.js index 52a0256a..a39fae0c 100644 --- a/commands/single/dark-light.js +++ b/commands/single/dark-light.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const types = ['default', 'moth', 'jojo', 'spoiler', 'nitro']; @@ -11,7 +12,7 @@ module.exports = class DarkLightCommand extends Command { memberName: 'dark-light', description: 'Determines whether you use dark or light theme.', details: `**Types:** ${types.join(', ')}`, - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'u/LennyMcLennington', diff --git a/commands/single/eat-pant.js b/commands/single/eat-pant.js index 8650debe..c47a988b 100644 --- a/commands/single/eat-pant.js +++ b/commands/single/eat-pant.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); module.exports = class EatPantCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class EatPantCommand extends Command { group: 'single', memberName: 'eat-pant', description: 'Eat pant.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'u/_Ebb', diff --git a/commands/single/eggs-get-laid.js b/commands/single/eggs-get-laid.js index 4b08e899..1d8bca46 100644 --- a/commands/single/eggs-get-laid.js +++ b/commands/single/eggs-get-laid.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); module.exports = class EggsGetLaidCommand extends Command { @@ -9,7 +10,7 @@ module.exports = class EggsGetLaidCommand extends Command { group: 'single', memberName: 'eggs-get-laid', description: 'Sends the ultimate roast.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: 'KINMOZA!', diff --git a/commands/single/fly.js b/commands/single/fly.js index 92f5833d..01c5e34b 100644 --- a/commands/single/fly.js +++ b/commands/single/fly.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); module.exports = class FlyCommand extends Command { @@ -8,7 +9,7 @@ module.exports = class FlyCommand extends Command { group: 'single', memberName: 'fly', description: 'Sends a fake fly that looks surprisngly real.', - clientPermissions: ['ATTACH_FILES'] + clientPermissions: [PermissionFlagsBits.AttachFiles] }); } diff --git a/commands/single/where-is-everybody.js b/commands/single/where-is-everybody.js index 20ba5517..f2520767 100644 --- a/commands/single/where-is-everybody.js +++ b/commands/single/where-is-everybody.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const { delay } = require('../../util/Util'); @@ -14,8 +15,8 @@ module.exports = class WhereIsEverybodyCommand extends Command { usages: 1, duration: 30 }, - clientPermissions: ['ATTACH_FILES', 'MENTION_EVERYONE'], - userPermissions: ['MENTION_EVERYONE'], + clientPermissions: [PermissionFlagsBits.AttachFiles, PermissionFlagsBits.MentionEveryone], + userPermissions: [PermissionFlagsBits.MentionEveryone], credit: [ { name: 'DreamWorks', diff --git a/commands/single/yoff.js b/commands/single/yoff.js index e72cadf4..b2662592 100644 --- a/commands/single/yoff.js +++ b/commands/single/yoff.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const types = ['default', 'blastyoff', 'disyoffjs', 'yoffcirius', 'yoffice', 'yofficer', 'gameyoff']; @@ -9,7 +10,7 @@ module.exports = class YoffCommand extends Command { group: 'single', memberName: 'yoff', description: 'Posts a picture that truly defines modern art.', - clientPermissions: ['ATTACH_FILES'], + clientPermissions: [PermissionFlagsBits.AttachFiles], credit: [ { name: '1Computer1', diff --git a/commands/util-public/changelog.js b/commands/util-public/changelog.js index ff9af33f..4b6be858 100644 --- a/commands/util-public/changelog.js +++ b/commands/util-public/changelog.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const request = require('node-superfetch'); const { shorten, embedURL } = require('../../util/Util'); const { GITHUB_ACCESS_TOKEN } = process.env; @@ -31,7 +31,7 @@ module.exports = class ChangelogCommand extends Command { .get(`https://api.github.com/repos/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}/commits`) .set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` }); const commits = body.slice(0, 10); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`[${XIAO_GITHUB_REPO_NAME}:master] Latest 10 commits`) .setColor(0x7289DA) .setURL(`https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}/commits/master`) diff --git a/commands/util-public/cloc.js b/commands/util-public/cloc.js index 35456e3a..e56cfacb 100644 --- a/commands/util-public/cloc.js +++ b/commands/util-public/cloc.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const { formatNumber } = require('../../util/Util'); const { promisify } = require('util'); const exec = promisify(require('child_process').execFile); @@ -13,7 +13,7 @@ module.exports = class ClocCommand extends Command { memberName: 'cloc', description: 'Responds with the bot\'s code line count.', guarded: true, - clientPermissions: ['EMBED_LINKS'] + clientPermissions: [PermissionFlagsBits.EmbedLinks] }); this.cache = null; @@ -21,9 +21,9 @@ module.exports = class ClocCommand extends Command { async run(msg) { const cloc = await this.cloc(); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x00AE86) - .setFooter(`${cloc.header.cloc_url} ${cloc.header.cloc_version}`) + .setFooter({ text: `${cloc.header.cloc_url} ${cloc.header.cloc_version}` }) .addField(`❯ JS (${formatNumber(cloc.JavaScript.nFiles)})`, formatNumber(cloc.JavaScript.code), true) .addField(`❯ JSON (${formatNumber(cloc.JSON.nFiles)})`, formatNumber(cloc.JSON.code), true) .addField(`❯ MD (${formatNumber(cloc.Markdown.nFiles)})`, formatNumber(cloc.Markdown.code), true) diff --git a/commands/util-public/credit.js b/commands/util-public/credit.js index ed5052dc..0d556272 100644 --- a/commands/util-public/credit.js +++ b/commands/util-public/credit.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { embedURL } = require('../../util/Util'); module.exports = class CreditCommand extends Command { @@ -29,14 +29,14 @@ module.exports = class CreditCommand extends Command { if (!command.credit) return msg.say('This command is credited to no one. It just appeared.'); const totalPages = Math.ceil(command.credit.length / 10); if (page > totalPages) return msg.say(`Page ${page} does not exist (yet).`); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${command.name} (Page ${page}/${totalPages})`) .setColor(0x7289DA) .setDescription(command.credit.slice((page - 1) * 10, page * 10).map(credit => { if (!credit.reasonURL) return `${embedURL(credit.name, credit.url)} (${credit.reason})`; return `${embedURL(credit.name, credit.url)} (${embedURL(credit.reason, credit.reasonURL)})`; }).join('\n')) - .setFooter(`${command.credit.length} Total Credit${command.credit.length === 1 ? '' : 's'}`); + .setFooter({ text: `${command.credit.length} Total Credit${command.credit.length === 1 ? '' : 's'}` }); return msg.embed(embed); } }; diff --git a/commands/util-public/help.js b/commands/util-public/help.js index 696c6247..c129e8dd 100644 --- a/commands/util-public/help.js +++ b/commands/util-public/help.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { stripIndents } = require('common-tags'); module.exports = class HelpCommand extends Command { @@ -26,7 +26,7 @@ module.exports = class HelpCommand extends Command { const embeds = []; for (let i = 0; i < Math.ceil(this.client.registry.groups.size / 10); i++) { const nsfw = msg.channel.nsfw || this.client.isOwner(msg.author); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`Command List (Page ${i + 1})`) .setDescription(stripIndents` To run a command, use ${this.usage()}. @@ -54,7 +54,7 @@ module.exports = class HelpCommand extends Command { } const allShown = cmdCount === this.client.registry.commands.size; embeds[embeds.length - 1] - .setFooter(`${this.client.registry.commands.size} Commands${allShown ? '' : ` (${cmdCount} Shown)`}`); + .setFooter({ text: `${this.client.registry.commands.size} Commands${allShown ? '' : ` (${cmdCount} Shown)`}` }); try { const msgs = []; for (const embed of embeds) msgs.push(await msg.direct({ embeds: [embed] })); @@ -64,8 +64,6 @@ module.exports = class HelpCommand extends Command { return msg.reply('Failed to send DM. You probably have DMs disabled.'); } } - const userPerms = command.userPermissions.length ? command.userPermissions.join(', ') : 'None'; - const clientPerms = command.clientPermissions.length ? command.clientPermissions.join(', ') : 'None'; return msg.say(stripIndents` __Command **${command.name}**__${command.guildOnly ? ' (Usable only in servers)' : ''} ${command.description}${command.details ? `\n${command.details}` : ''} @@ -76,8 +74,6 @@ module.exports = class HelpCommand extends Command { **Aliases:** ${command.aliases.join(', ') || 'None'} **Group:** ${command.group.name} (\`${command.groupID}:${command.memberName}\`) **NSFW:** ${command.nsfw ? 'Yes' : 'No'} - **Permissions You Need:** ${userPerms} - **Permissions I Need:** ${clientPerms} `); } }; diff --git a/commands/util-public/info.js b/commands/util-public/info.js index 2a4dfeea..fd4da8cd 100644 --- a/commands/util-public/info.js +++ b/commands/util-public/info.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed, version: djsVersion } = require('discord.js'); +const { EmbedBuilder, version: djsVersion, PermissionFlagsBits } = require('discord.js'); const moment = require('moment'); require('moment-duration-format'); const { formatNumber, embedURL } = require('../../util/Util'); @@ -15,16 +15,16 @@ module.exports = class InfoCommand extends Command { memberName: 'info', description: 'Responds with detailed bot information.', guarded: true, - clientPermissions: ['EMBED_LINKS'] + clientPermissions: [PermissionFlagsBits.EmbedLinks] }); } run(msg) { - const invite = this.client.generateInvite({ permissions: ['ADMINISTRATOR'], scopes: ['bot'] }); + const invite = this.client.generateInvite({ permissions: [PermissionFlagsBits.Administrator], scopes: ['bot'] }); const prefix = msg.guild ? msg.guild.commandPrefix : this.client.commandPrefix; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(0x00AE86) - .setFooter(copyright.join('\n')) + .setFooter({ text: copyright.join('\n') }) .addField('❯ Servers', formatNumber(this.client.guilds.cache.size), true) .addField('❯ Commands', formatNumber(this.client.registry.commands.size), true) .addField('❯ Shards', formatNumber(this.client.options.shardCount), true) diff --git a/commands/util-public/report.js b/commands/util-public/report.js index 37f5bf72..3e00129c 100644 --- a/commands/util-public/report.js +++ b/commands/util-public/report.js @@ -1,7 +1,7 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const reasons = ['bug', 'feedback', 'suggestion', 'abuse']; -const reasonColors = ['RED', 'GREEN', 'YELLOW', 'ORANGE']; +const reasonColors = ['Red', 'Green', 'Yellow', 'Orange']; const displayReasons = ['🐛 Bug Report', '📬 Feedback', '❓ Suggestion', '⚠️ Abuse']; module.exports = class ReportCommand extends Command { @@ -29,11 +29,11 @@ module.exports = class ReportCommand extends Command { } async run(msg, { reason, message }) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription(message) .setTitle(displayReasons[reason]) - .setAuthor(msg.author.tag) - .setFooter(`ID: ${msg.author.id}`) + .setAuthor({ name: msg.author.tag }) + .setFooter({ text: `ID: ${msg.author.id}` }) .setTimestamp() .setColor(reasonColors[reason]); const channel = await this.client.fetchReportChannel(); diff --git a/commands/util-voice/join.js b/commands/util-voice/join.js index 62085df5..e32eef36 100644 --- a/commands/util-voice/join.js +++ b/commands/util-voice/join.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { joinVoiceChannel } = require('@discordjs/voice'); const Dispatcher = require('../../structures/Dispatcher'); @@ -6,20 +7,20 @@ module.exports = class JoinCommand extends Command { constructor(client) { super(client, { name: 'join', - aliases: ['join-voice-channel', 'join-vc', 'join-voice', 'join-channel', 'connect'], + aliases: ['join-voice-channel', 'join-vc', 'join-voice', 'join-channel', PermissionFlagsBits.Connect], group: 'util-voice', memberName: 'join', description: 'Joins your voice channel.', guildOnly: true, guarded: true, - userPermissions: ['CONNECT'] + userPermissions: [PermissionFlagsBits.Connect] }); } run(msg) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please enter a voice channel first.'); - if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK', 'VIEW_CHANNEL'])) { + if (!voiceChannel.permissionsFor(this.client.user).has([PermissionFlagsBits.Connect, PermissionFlagsBits.Speak, 'VIEW_CHANNEL'])) { return msg.reply('I\'m missing the "Connect", "Speak", or "View Channel" permission for this channel.'); } if (!voiceChannel.joinable) return msg.reply('Your voice channel is not joinable.'); diff --git a/commands/util-voice/leave.js b/commands/util-voice/leave.js index 5b1a9f19..d17b5e06 100644 --- a/commands/util-voice/leave.js +++ b/commands/util-voice/leave.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class LeaveCommand extends Command { constructor(client) { @@ -20,7 +21,7 @@ module.exports = class LeaveCommand extends Command { const usage = this.client.registry.commands.get('stop').usage(); return msg.reply(`I am currently playing audio in this server. Please use ${usage} first.`); } - if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) { return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); } connection.leave(); diff --git a/commands/util-voice/pause.js b/commands/util-voice/pause.js index c972ee21..a0581818 100644 --- a/commands/util-voice/pause.js +++ b/commands/util-voice/pause.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class PauseCommand extends Command { constructor(client) { @@ -19,7 +20,7 @@ module.exports = class PauseCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } - if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) { return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); } connection.pause(); diff --git a/commands/util-voice/resume.js b/commands/util-voice/resume.js index a67abd46..0904d700 100644 --- a/commands/util-voice/resume.js +++ b/commands/util-voice/resume.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class ResumeCommand extends Command { constructor(client) { @@ -19,7 +20,7 @@ module.exports = class ResumeCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } - if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) { return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); } connection.unpause(); diff --git a/commands/util-voice/stop.js b/commands/util-voice/stop.js index c01f50fa..c9bd41cd 100644 --- a/commands/util-voice/stop.js +++ b/commands/util-voice/stop.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class StopCommand extends Command { constructor(client) { @@ -19,7 +20,7 @@ module.exports = class StopCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } - if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) { return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); } connection.stop(); diff --git a/commands/util/banner.js b/commands/util/banner.js index 568c36d5..1f3d4439 100644 --- a/commands/util/banner.js +++ b/commands/util/banner.js @@ -1,9 +1,5 @@ const Command = require('../../framework/Command'); -const { DataResolver } = require('discord.js'); -const { REST } = require('@discordjs/rest'); -const { Routes } = require('discord-api-types/v10'); -const { XIAO_TOKEN } = process.env; -const rest = new REST({ version: '10' }).setToken(XIAO_TOKEN); +const { DataResolver, Routes } = require('discord.js'); module.exports = class BannerCommand extends Command { constructor(client) { @@ -25,7 +21,7 @@ module.exports = class BannerCommand extends Command { } async run(msg, { image }) { - await rest.patch(Routes.user(), { + await this.client.rest.patch(Routes.user(), { body: { banner: await DataResolver.resolveImage(image) } }); return msg.say('Set the banner.'); diff --git a/commands/util/report-respond.js b/commands/util/report-respond.js index ee0074ce..6bc581cb 100644 --- a/commands/util/report-respond.js +++ b/commands/util/report-respond.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const types = ['reject', 'info', 'approve']; const typesColors = ['RED', 'YELLOW', 'GREEN']; const displaytypes = ['❌ Rejected', '❓ Need More Info', '✅ Accepted/Fixed']; @@ -35,11 +35,11 @@ module.exports = class ReportRespondCommand extends Command { } async run(msg, { user, type, message }) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription(message) .setTitle(displaytypes[type]) - .setAuthor(msg.author.tag) - .setFooter(`ID: ${msg.author.id}`) + .setAuthor({ name: msg.author.tag }) + .setFooter({ text: `ID: ${msg.author.id}` }) .setTimestamp() .setColor(typesColors[type]); try { diff --git a/commands/voice/airhorn.js b/commands/voice/airhorn.js index 3b754ec4..f1be43ac 100644 --- a/commands/voice/airhorn.js +++ b/commands/voice/airhorn.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const { reactIfAble } = require('../../util/Util'); const fs = require('fs'); @@ -16,7 +17,7 @@ module.exports = class AirhornCommand extends Command { usages: 2, duration: 10 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'Discord', diff --git a/commands/voice/animalese.js b/commands/voice/animalese.js index 0e9dbcb2..38a9e928 100644 --- a/commands/voice/animalese.js +++ b/commands/voice/animalese.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const path = require('path'); const { reactIfAble } = require('../../util/Util'); const fs = require('fs'); @@ -25,7 +26,7 @@ module.exports = class AnimaleseCommand extends Command { usages: 2, duration: 10 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'Acedio', diff --git a/commands/voice/dec-talk.js b/commands/voice/dec-talk.js index 366f8584..733a745e 100644 --- a/commands/voice/dec-talk.js +++ b/commands/voice/dec-talk.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const { Readable } = require('stream'); const { exec } = require('child_process'); const { promisify } = require('util'); @@ -21,7 +22,7 @@ module.exports = class DECTalkCommand extends Command { usages: 2, duration: 10 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'Digital Equipment Corporation', diff --git a/commands/voice/mindfulness.js b/commands/voice/mindfulness.js index f554f689..9e3505fe 100644 --- a/commands/voice/mindfulness.js +++ b/commands/voice/mindfulness.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { Readable } = require('stream'); const { reactIfAble } = require('../../util/Util'); @@ -17,7 +18,7 @@ module.exports = class MindfulnessCommand extends Command { usages: 2, duration: 10 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'InspiroBot', diff --git a/commands/voice/play.js b/commands/voice/play.js index 3c9e2ca0..27474a8f 100644 --- a/commands/voice/play.js +++ b/commands/voice/play.js @@ -1,5 +1,5 @@ const Command = require('../../framework/Command'); -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder, PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const ytdl = require('ytdl-core'); const { shorten, verify } = require('../../util/Util'); @@ -19,7 +19,7 @@ module.exports = class PlayCommand extends Command { usages: 2, duration: 60 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'Google', @@ -85,11 +85,11 @@ module.exports = class PlayCommand extends Command { } generateEmbed(data) { - return new MessageEmbed() + return new EmbedBuilder() .setColor(0xDD2825) .setTitle(shorten(data.videoDetails.title, 70)) .setDescription(shorten(data.videoDetails.description, 100)) - .setAuthor('YouTube', logos.youtube, 'https://www.youtube.com/') + .setAuthor({ name: 'YouTube', iconURL: logos.youtube, url: 'https://www.youtube.com/' }) .setURL(data.videoDetails.video_url) .setThumbnail(data.videoDetails.thumbnails.length ? data.videoDetails.thumbnails[0].url : null) .addField('❯ ID', data.videoDetails.videoId, true) diff --git a/commands/voice/tts.js b/commands/voice/tts.js index 73a98d48..ed331429 100644 --- a/commands/voice/tts.js +++ b/commands/voice/tts.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); const request = require('node-superfetch'); const { Readable } = require('stream'); const { reactIfAble } = require('../../util/Util'); @@ -18,7 +19,7 @@ module.exports = class TtsCommand extends Command { usages: 2, duration: 10 }, - userPermissions: ['CONNECT', 'SPEAK'], + userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak], credit: [ { name: 'Google', diff --git a/framework/Client.js b/framework/Client.js index 4a0ee74f..89cce100 100644 --- a/framework/Client.js +++ b/framework/Client.js @@ -1,4 +1,4 @@ -const { Client } = require('discord.js'); +const { Client, PermissionFlagsBits } = require('discord.js'); const { Collection } = require('@discordjs/collection'); const fs = require('fs'); const path = require('path'); @@ -39,7 +39,7 @@ module.exports = class CommandClient extends Client { if (!msg.author) return; if (msg.channel.partial) msg.channel = await this.channels.fetch(msg.channel.id); - if (msg.partial) msg = await msg.channel.messages.fetch(msg.id); + if (msg.partial) msg = await msg.channel.messages.fetch({ message: msg.id }); if (msg.guild && (!msg.member || msg.member.partial || !msg.guild.members.cache.has(msg.author.id))) { try { await msg.guild.members.fetch(msg.author.id); @@ -51,7 +51,7 @@ module.exports = class CommandClient extends Client { if (msg.author.bot) return; if (this.blacklist.user.includes(msg.author.id)) return; if (msg.guild && this.blacklist.guild.includes(msg.guild.id)) return; - if (msg.guild && !msg.channel.permissionsFor(this.user).has('SEND_MESSAGES')) return; + if (msg.guild && !msg.channel.permissionsFor(this.user).has(PermissionFlagsBits.SendMessages)) return; const patternCmd = this.dispatcher.isPatternCommand(msg); if (patternCmd) { diff --git a/framework/Extensions.js b/framework/Extensions.js index b11fa887..84096299 100644 --- a/framework/Extensions.js +++ b/framework/Extensions.js @@ -1,5 +1,5 @@ /* eslint-disable */ -const { Message } = require('discord.js'); +const { Message, EmbedBuilder } = require('discord.js'); Reflect.defineProperty(Message.prototype, 'say', { value: function (content, options) { if (typeof content === 'object') return this.channel.send(content); @@ -23,4 +23,12 @@ Reflect.defineProperty(Message.prototype, 'reply', { value: function (content, o if (typeof content === 'object') return this.channel.send(content, { reply: { messageReference: this } }); return this.channel.send({ content, ...options, reply: { messageReference: this } }); } }); + +Reflect.defineProperty(EmbedBuilder.prototype, 'addField', { value: function (name, value, inline = false) { + return this.addFields([{ name, value, inline }]); +} }); + +Reflect.defineProperty(EmbedBuilder.prototype, 'addBlankField', { value: function (inline = false) { + return this.addFields([{ name: '\u200b', value: '\u200b', inline }]); +} }); /* eslint-enable */ diff --git a/framework/types/message.js b/framework/types/message.js index e08bc766..25fc8410 100644 --- a/framework/types/message.js +++ b/framework/types/message.js @@ -7,7 +7,7 @@ module.exports = class MessageArgumentType extends ArgumentType { async validate(val, msg) { if (!/^[0-9]+$/.test(val)) return false; - return Boolean(await msg.channel.messages.fetch(val).catch(() => null)); + return Boolean(await msg.channel.messages.fetch({ message: val }).catch(() => null)); } parse(val, msg) { diff --git a/package.json b/package.json index 3fa6ffd5..88d953cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "143.0.0", + "version": "144.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true, @@ -30,9 +30,7 @@ "node": ">=15" }, "dependencies": { - "@discordjs/collection": "^2.0.0", "@discordjs/opus": "^0.9.0", - "@discordjs/rest": "^2.2.0", "@discordjs/voice": "^0.16.1", "@mediapipe/face_detection": "^0.4.1646425229", "@tensorflow/tfjs-node": "^4.17.0", @@ -48,7 +46,7 @@ "connect4-ai": "^0.1.3", "custom-translate": "^2.2.8", "didyoumean2": "^6.0.1", - "discord.js": "^13.17.1", + "discord.js": "^14.14.1", "dotenv": "^16.4.5", "emoji-regex": "^10.3.0", "fen-validator": "^2.0.1", diff --git a/structures/Client.js b/structures/Client.js index 783ba784..81d5f2cf 100644 --- a/structures/Client.js +++ b/structures/Client.js @@ -16,7 +16,7 @@ const Font = require('./Font'); const PhoneManager = require('./phone/PhoneManager'); const TimerManager = require('./remind/TimerManager'); const PokemonStore = require('./pokemon/PokemonStore'); -const activities = require('../assets/json/activity'); +const activities = require('./activity'); const { REPORT_CHANNEL_ID, JOIN_LEAVE_CHANNEL_ID, COMMAND_CHANNEL_ID } = process.env; module.exports = class XiaoClient extends CommandClient { diff --git a/structures/activity.js b/structures/activity.js new file mode 100644 index 00000000..2556cd03 --- /dev/null +++ b/structures/activity.js @@ -0,0 +1,73 @@ +const { ActivityType } = require('discord.js'); +const { formatNumber } = require('./util/Util'); + +module.exports = [ + { + text: 'Rune Factory 4', + type: ActivityType.Playing + }, + { + text: 'Rune Factory 4 Special', + type: ActivityType.Playing + }, + { + text: 'with your heart', + type: ActivityType.Playing + }, + { + text: 'you eat pant', + type: ActivityType.Watching + }, + { + text: 'anime', + type: ActivityType.Watching + }, + { + text: 'over the inn', + type: ActivityType.Watching + }, + { + text: 'at the inn', + type: ActivityType.Playing + }, + { + text: 'in Selphia', + type: ActivityType.Playing + }, + { + text: 'with Amber', + type: ActivityType.Playing + }, + { + text: 'with a cardboard box', + type: ActivityType.Playing + }, + { + text: 'in the fridge', + type: ActivityType.Playing + }, + { + text: 'with a knife', + type: ActivityType.Playing + }, + { + text: 'with a murderous cow', + type: ActivityType.Playing + }, + { + text: 'with a linter', + type: ActivityType.Playing + }, + { + text: (client) => `${formatNumber(client.guilds.cache.size)} servers`, + type: ActivityType.Watching + }, + { + text: (client) => `with ${formatNumber(client.registry.commands.size)} commands`, + type: ActivityType.Playing + }, + { + text: (client) => `${formatNumber(client.channels.cache.size)} channels`, + type: ActivityType.Watching + } +]; diff --git a/structures/cards-against-humanity/Player.js b/structures/cards-against-humanity/Player.js index df3220cc..88cff23c 100644 --- a/structures/cards-against-humanity/Player.js +++ b/structures/cards-against-humanity/Player.js @@ -1,5 +1,5 @@ const { stripIndents } = require('common-tags'); -const { Util: { escapeMarkdown } } = require('discord.js'); +const { escapeMarkdown } = require('discord.js'); const { reactIfAble } = require('../../util/Util'); const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env; diff --git a/structures/commands/AutoReply.js b/structures/commands/AutoReply.js index 11aec3ab..e4ee4cef 100644 --- a/structures/commands/AutoReply.js +++ b/structures/commands/AutoReply.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); module.exports = class AutoReplyCommand extends Command { constructor(client, info) { @@ -9,7 +10,7 @@ module.exports = class AutoReplyCommand extends Command { } run(msg) { - if (msg.guild && !msg.channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) return null; + if (msg.guild && !msg.channel.permissionsFor(this.client.user).has(PermissionFlagsBits.SendMessages)) return null; const text = this.generateText(); if (!text) return null; return this.reply ? msg.reply(text) : msg.say(text); diff --git a/types/image-or-avatar.js b/types/image-or-avatar.js index 4c79375b..52ecdeca 100644 --- a/types/image-or-avatar.js +++ b/types/image-or-avatar.js @@ -15,7 +15,7 @@ module.exports = class ImageOrAvatarArgument extends Argument { const image = this.client.registry.types.get('image').parse(value, msg, arg); if (image) return image; const user = await this.client.registry.types.get('user').parse(value, msg, arg); - return user.displayAvatarURL({ format: 'png', size: arg.avatarSize || 512 }); + return user.displayAvatarURL({ extension: 'png', size: arg.avatarSize || 512 }); } isEmpty(value, msg, arg) { diff --git a/util/Util.js b/util/Util.js index cfa3745d..e07ccce9 100644 --- a/util/Util.js +++ b/util/Util.js @@ -1,4 +1,4 @@ -const { MessageActionRow, MessageButton } = require('discord.js'); +const { ActionRowBuilder, ButtonBuilder, PermissionFlagsBits, ButtonStyle, ComponentType } = require('discord.js'); const crypto = require('crypto'); const request = require('node-superfetch'); const fs = require('fs'); @@ -289,10 +289,10 @@ module.exports = class Util { static async reactIfAble(msg, user, emoji, fallbackEmoji) { const dm = !msg.guild; if (!emoji) emoji = fallbackEmoji; - if (fallbackEmoji && (!dm && !msg.channel.permissionsFor(user).has('USE_EXTERNAL_EMOJIS'))) { + if (fallbackEmoji && (!dm && !msg.channel.permissionsFor(user).has(PermissionFlagsBits.UseExternalEmojis))) { emoji = fallbackEmoji; } - if (dm || msg.channel.permissionsFor(user).has(['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'])) { + if (dm || msg.channel.permissionsFor(user).has([PermissionFlagsBits.AddReactions, 'READ_MESSAGE_HISTORY'])) { try { await msg.react(emoji); } catch { @@ -340,9 +340,9 @@ module.exports = class Util { static async awaitPlayers(msg, max, min, blacklist) { if (max === 1) return [msg.author.id]; const addS = min - 1 === 1 ? '' : 's'; - const row = new MessageActionRow().addComponents( - new MessageButton().setCustomId('join').setLabel('Join Game').setStyle('PRIMARY'), - new MessageButton().setCustomId('start').setLabel('Start Game').setStyle('SUCCESS') + const row = new ActionRowBuilder().addComponents( + new ButtonBuilder().setCustomId('join').setLabel('Join Game').setStyle(ButtonStyle.Primary), + new ButtonBuilder().setCustomId('start').setLabel('Start Game').setStyle(ButtonStyle.Success) ); let text = stripIndents` You will need at least ${min - 1} more player${addS} (at max ${max - 1}). @@ -364,7 +364,7 @@ module.exports = class Util { }; const collector = msg.channel.createMessageComponentCollector({ filter, - componentType: 'BUTTON', + componentType: ComponentType.Button, max: max - 1, time: 120000 });