diff --git a/classes/imageCommand.js b/classes/imageCommand.js index cab4e84..a9ba426 100644 --- a/classes/imageCommand.js +++ b/classes/imageCommand.js @@ -92,8 +92,11 @@ class ImageCommand extends Command { if (e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit."; throw e; } finally { - const statusChannel = status.channel ?? await this.client.rest.channels.get(status.channelID); - if (status && (statusChannel.messages ? statusChannel.messages.has(status.id) : await this.client.getMessage(statusChannel.id, status.id).catch(() => undefined))) await status.delete(); + try { + if (status) await status.delete(); + } catch { + // no-op + } runningCommands.delete(this.author.id); } diff --git a/commands/general/help.js b/commands/general/help.js index b4a6c74..4c94bea 100644 --- a/commands/general/help.js +++ b/commands/general/help.js @@ -54,7 +54,7 @@ class HelpCommand extends Command { } return embed; } else { - if (this.guild && !this.channel.permissionsOf(this.client.user.id).has("EMBED_LINKS")) { + if (this.guild && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) { this.success = false; return "I don't have the `Embed Links` permission!"; } diff --git a/commands/general/image.js b/commands/general/image.js index b3358c2..9c994ab 100644 --- a/commands/general/image.js +++ b/commands/general/image.js @@ -8,7 +8,7 @@ import Command from "../../classes/command.js"; class ImageSearchCommand extends Command { async run() { this.success = false; - if (this.channel && !this.channel.permissionsOf(this.client.user.id).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!"; + if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!"; const query = this.options.query ?? this.args.join(" "); if (!query || !query.trim()) return "You need to provide something to search for!"; await this.acknowledge(); diff --git a/commands/general/imagestats.js b/commands/general/imagestats.js index 591726b..e8952f7 100644 --- a/commands/general/imagestats.js +++ b/commands/general/imagestats.js @@ -8,7 +8,7 @@ class ImageStatsCommand extends Command { embeds: [{ "author": { "name": "esmBot Image Statistics", - "iconURL": this.client.user.avatarURL + "iconURL": this.client.user.avatarURL() }, "color": 16711680, "description": `The bot is currently connected to ${connections.size} image server(s).`, diff --git a/commands/music/nowplaying.js b/commands/music/nowplaying.js index bdeee76..753d42e 100644 --- a/commands/music/nowplaying.js +++ b/commands/music/nowplaying.js @@ -17,7 +17,7 @@ class NowPlayingCommand extends MusicCommand { color: 16711680, author: { name: "Now Playing", - iconURL: this.client.user.avatarURL + iconURL: this.client.user.avatarURL() }, fields: [{ name: "ℹī¸ Title", diff --git a/commands/music/play.js b/commands/music/play.js index 39cfd98..43c341e 100644 --- a/commands/music/play.js +++ b/commands/music/play.js @@ -5,12 +5,12 @@ const prefixes = ["ytsearch:", "ytmsearch:", "scsearch:", "spsearch:", "amsearch class PlayCommand extends MusicCommand { async run() { const input = this.options.query ?? this.args.join(" "); - if (!input && ((!this.message || this.message?.attachments.length <= 0))) { + if (!input && ((!this.message || this.message?.attachments.size <= 0))) { this.success = false; return "You need to provide what you want to play!"; } let query = input ? input.trim() : ""; - const attachment = this.type === "classic" ? this.message.attachments[0] : null; + const attachment = this.type === "classic" ? this.message.attachments.first() : null; if (query.startsWith("||") && query.endsWith("||")) { query = query.substring(2, query.length - 2); } diff --git a/commands/music/queue.js b/commands/music/queue.js index 9f7857e..70e3c96 100644 --- a/commands/music/queue.js +++ b/commands/music/queue.js @@ -10,7 +10,7 @@ class QueueCommand extends MusicCommand { if (!this.guild) return "This command only works in servers!"; if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!"; if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!"; - if (!this.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; + if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!"; const player = this.connection; const node = nodes.filter((val) => val.name === player.player.node.name)[0]; const tracks = await request(`http://${node.url}/decodetracks`, { method: "POST", body: JSON.stringify(this.queue), headers: { authorization: node.auth, "content-type": "application/json" } }).then(res => res.body.json()); @@ -30,7 +30,7 @@ class QueueCommand extends MusicCommand { embeds: [{ author: { name: "Queue", - iconURL: this.client.user.avatarURL + iconURL: this.client.user.avatarURL() }, color: 16711680, footer: { diff --git a/commands/tags/tags.js b/commands/tags/tags.js index 23bc9ec..102b59a 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -57,7 +57,7 @@ class TagsCommand extends Command { return `This tag is owned by **${user.username}#${user.discriminator}** (\`${getResult.author}\`).`; } } else if (cmd === "list") { - if (!this.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; + if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!"; const tagList = await database.getTags(this.guild.id); const embeds = []; const groups = Object.keys(tagList).map((item, index) => { @@ -76,7 +76,7 @@ class TagsCommand extends Command { description: value.join("\n"), author: { name: this.author.username, - iconURL: this.author.avatarURL + iconURL: this.author.avatarURL() } }] }); diff --git a/events/voiceChannelLeave.js b/events/voiceChannelLeave.js index a59659b..137b21b 100644 --- a/events/voiceChannelLeave.js +++ b/events/voiceChannelLeave.js @@ -47,7 +47,7 @@ export default async (client, member, oldChannel) => { queues.delete(connection.originalChannel.guildID); skipVotes.delete(connection.originalChannel.guildID); client.rest.channels.createMessage(connection.originalChannel.id, { - content: `🔊 The voice channel session in \`${connection.originalChannel.name}\` has ended.` + content: `🔊 The voice channel session in \`${connection.voiceChannel.name}\` has ended.` }); } }); @@ -83,7 +83,7 @@ export default async (client, member, oldChannel) => { queues.delete(connection.originalChannel.guildID); skipVotes.delete(connection.originalChannel.guildID); client.rest.channels.createMessage(connection.originalChannel.id, { - content: `🔊 The voice channel session in \`${connection.originalChannel.name}\` has ended.` + content: `🔊 The voice channel session in \`${connection.voiceChannel.name}\` has ended.` }); } else { const randomMember = random(members); @@ -105,7 +105,7 @@ export default async (client, member, oldChannel) => { queues.delete(connection.originalChannel.guildID); skipVotes.delete(connection.originalChannel.guildID); await client.rest.channels.createMessage(connection.originalChannel.id, { - content: `🔊 The voice channel session in \`${connection.originalChannel.name}\` has ended.` + content: `🔊 The voice channel session in \`${connection.voiceChannel.name}\` has ended.` }); } } diff --git a/utils/awaitrejoin.js b/utils/awaitrejoin.js index 55408ef..f2d7ed1 100644 --- a/utils/awaitrejoin.js +++ b/utils/awaitrejoin.js @@ -10,7 +10,7 @@ class AwaitRejoin extends EventEmitter { this.channel = channel; this.rejoined = false; this.ended = false; - this.bot = channel.guild ? channel.guild.shard._client : channel._client; + this.bot = channel.client; this.listener = (member, newChannel) => this.verify(member, newChannel); this.bot.on("voiceChannelJoin", this.listener); this.bot.on("voiceChannelSwitch", this.listener); diff --git a/utils/soundplayer.js b/utils/soundplayer.js index f108981..c34dcd2 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -63,9 +63,9 @@ export async function play(client, sound, options, music = false) { if (!manager) return { content: "The sound commands are still starting up!", flags: 64 }; if (!options.channel.guild) return { content: "This command only works in servers!", flags: 64 }; if (!options.member.voiceState.channelID) return { content: "You need to be in a voice channel first!", flags: 64 }; - if (!options.channel.guild.permissionsOf(client.user.id).has("voiceConnect")) return { content: "I can't join this voice channel!", flags: 64 }; + if (!options.channel.guild.permissionsOf(client.user.id.toString()).has("CONNECT")) return { content: "I can't join this voice channel!", flags: 64 }; const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID); - if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return { content: "I don't have permission to join this voice channel!", flags: 64 }; + if (!voiceChannel.permissionsOf(client.user.id.toString()).has("CONNECT")) return { content: "I don't have permission to join this voice channel!", flags: 64 }; if (!music && manager.players.has(options.channel.guildID)) return { content: "I can't play a sound effect while other audio is playing!", flags: 64 }; let node = manager.getNode(); if (!node) { @@ -132,7 +132,7 @@ export async function nextSong(client, options, connection, track, info, music, color: 16711680, author: { name: "Now Playing", - iconURL: client.user.avatarURL + iconURL: client.user.avatarURL() }, fields: [{ name: "ℹī¸ Title",