From db7bb7f49f9585e570ca0a43b30f65e687a7efdf Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 11 Feb 2020 15:40:49 -0500 Subject: [PATCH] This is going to error so bad --- commands/info/discriminator.js | 4 +++- commands/info/emoji-list.js | 2 +- commands/info/server.js | 6 +++--- commands/info/user.js | 2 +- commands/other/rename-all.js | 2 +- commands/random/random-user.js | 2 +- commands/text-edit/portal-send.js | 6 ++++-- commands/util/info.js | 2 +- package.json | 2 +- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/commands/info/discriminator.js b/commands/info/discriminator.js index 05206a7d..9b3c16b4 100644 --- a/commands/info/discriminator.js +++ b/commands/info/discriminator.js @@ -27,7 +27,9 @@ module.exports = class DiscriminatorCommand extends Command { } run(msg, { discrim }) { - const users = this.client.users.filter(user => user.discriminator === discrim).map(user => user.username); + const users = this.client.users.cache + .filter(user => user.discriminator === discrim) + .map(user => user.username); return msg.say(stripIndents` **Found ${users.length} users with the discriminator #${discrim}:** ${trimArray(users, 50).join(', ')} diff --git a/commands/info/emoji-list.js b/commands/info/emoji-list.js index 0b3e8409..cc65c1be 100644 --- a/commands/info/emoji-list.js +++ b/commands/info/emoji-list.js @@ -25,7 +25,7 @@ module.exports = class EmojiListCommand extends Command { } run(msg, { type }) { - const emojis = msg.guild.emojis.filter(emoji => type === 'animated' ? emoji.animated : !emoji.animated); + const emojis = msg.guild.emojis.cache.filter(emoji => type === 'animated' ? emoji.animated : !emoji.animated); if (!emojis.size) return msg.say(`This server has no ${type} custom emoji.`); return msg.say(emojis.map(emoji => emoji.toString()).sort().join(' '), { split: { char: ' ' } }); } diff --git a/commands/info/server.js b/commands/info/server.js index ef11cf47..8fa8701d 100644 --- a/commands/info/server.js +++ b/commands/info/server.js @@ -19,7 +19,7 @@ module.exports = class ServerCommand extends Command { } async run(msg) { - if (!msg.guild.members.has(msg.guild.ownerID)) await msg.guild.members.fetch(msg.guild.ownerID); + if (!msg.guild.members.cache.has(msg.guild.ownerID)) await msg.guild.members.fetch(msg.guild.ownerID); const embed = new MessageEmbed() .setColor(0x00AE86) .setThumbnail(msg.guild.iconURL({ format: 'png' })) @@ -35,8 +35,8 @@ module.exports = class ServerCommand extends Command { **Server Stats:** • Members: ${msg.guild.memberCount} - • Roles: ${msg.guild.roles.size} - • Channels: ${msg.guild.channels.filter(channel => channel.type !== 'category').size} + • Roles: ${msg.guild.roles.cache.size} + • Channels: ${msg.guild.channels.cache.filter(channel => channel.type !== 'category').size} `); return msg.embed(embed); } diff --git a/commands/info/user.js b/commands/info/user.js index dc508cab..ee6143d8 100644 --- a/commands/info/user.js +++ b/commands/info/user.js @@ -38,7 +38,7 @@ module.exports = class UserCommand extends Command { if (msg.channel.type === 'text') { try { const member = await msg.guild.members.fetch(user.id); - const defaultRole = msg.guild.roles.get(msg.guild.id); + const defaultRole = msg.guild.roles.cache.get(msg.guild.id); const roles = member.roles .filter(role => role.id !== defaultRole.id) .sort((a, b) => b.position - a.position) diff --git a/commands/other/rename-all.js b/commands/other/rename-all.js index 7ca52e23..4c5e57bb 100644 --- a/commands/other/rename-all.js +++ b/commands/other/rename-all.js @@ -47,7 +47,7 @@ module.exports = class RenameAllCommand extends Command { await msg.guild.members.fetch(); await msg.reply('Fetched members! Renaming...'); let i = 0; - for (const member of msg.guild.members.values()) { + for (const member of msg.guild.members.cache.values()) { try { await member.setNickname(nickname); } catch (err) { diff --git a/commands/random/random-user.js b/commands/random/random-user.js index 12389ed5..a731cdc1 100644 --- a/commands/random/random-user.js +++ b/commands/random/random-user.js @@ -16,6 +16,6 @@ module.exports = class RandomUserCommand extends Command { const members = [this.client.user, msg.channel.recipient]; return msg.say(`I choose ${members[Math.floor(Math.random() * members.length)].username}!`); } - return msg.say(`I choose ${msg.guild.members.random().displayName}!`); + return msg.say(`I choose ${msg.guild.members.cache.random().displayName}!`); } }; diff --git a/commands/text-edit/portal-send.js b/commands/text-edit/portal-send.js index 77bf05dc..e64b0d1b 100644 --- a/commands/text-edit/portal-send.js +++ b/commands/text-edit/portal-send.js @@ -21,10 +21,12 @@ module.exports = class PortalSendCommand extends Command { async run(msg, { message }) { if (/discord(\.gg|app\.com\/invite|\.me)\//gi.test(message)) return msg.reply('Please do not send invites.'); - let channels = this.client.channels.filter( + let channels = this.client.channels.cache.filter( channel => channel.type === 'text' && channel.topic && channel.topic.includes('') ); - if (msg.channel.type === 'text') channels = channels.filter(channel => !msg.guild.channels.has(channel.id)); + if (msg.channel.type === 'text') { + channels = channels.filter(channel => !msg.guild.channels.cache.has(channel.id)); + } if (!channels.size) return msg.reply('No channels have an open portal...'); const channel = channels.random(); try { diff --git a/commands/util/info.js b/commands/util/info.js index 3525a813..3c9da840 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -24,7 +24,7 @@ module.exports = class InfoCommand extends Command { const embed = new MessageEmbed() .setColor(0x00AE86) .setFooter('©2017-2020 dragonfire535#8081') - .addField('❯ Servers', formatNumber(this.client.guilds.size), true) + .addField('❯ Servers', formatNumber(this.client.guilds.cache.size), true) .addField('❯ Shards', formatNumber(this.client.options.shardCount), true) .addField('❯ Commands', formatNumber(this.client.registry.commands.size), true) .addField('❯ Home Server', this.client.options.invite ? `[Here](${this.client.options.invite})` : 'None', true) diff --git a/package.json b/package.json index db497768..cdf9c8b0 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "cheerio": "^1.0.0-rc.3", "common-tags": "^1.8.0", "custom-translate": "^2.2.8", - "discord.js": "github:discordjs/discord.js#fe7df708e44e0280dfaf0f8e457b154781bb5140", + "discord.js": "github:discordjs/discord.js", "discord.js-commando": "github:discordjs/Commando", "dotenv": "^8.2.0", "gifencoder": "^2.0.1",