Fix some permission checks, fix avatar URLs

This commit is contained in:
Essem 2022-09-23 23:50:59 -05:00
parent 888f2f8b4a
commit 49a60bba96
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
11 changed files with 22 additions and 19 deletions

View file

@ -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!";
}

View file

@ -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();

View file

@ -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).`,

View file

@ -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",

View file

@ -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);
}

View file

@ -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: {

View file

@ -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()
}
}]
});