Fix some permission checks, fix avatar URLs
This commit is contained in:
parent
888f2f8b4a
commit
49a60bba96
11 changed files with 22 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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!";
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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).`,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
|
|
@ -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.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue