codePreviews: i guess we're checking for permissions now
This commit is contained in:
parent
37f550ac1e
commit
0f9bd6edeb
1 changed files with 3 additions and 2 deletions
|
@ -110,6 +110,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
|
||||||
if (msg.author.id == hf.bot.user.id) return;
|
if (msg.author.id == hf.bot.user.id) return;
|
||||||
if (!msg.guildID) return;
|
if (!msg.guildID) return;
|
||||||
if (!(await hasFlag(msg.guildID, "codePreviews"))) return;
|
if (!(await hasFlag(msg.guildID, "codePreviews"))) return;
|
||||||
|
if (!msg.channel.permissionsOf(hf.bot.user.id).has("sendMessages")) return;
|
||||||
|
|
||||||
const files = [];
|
const files = [];
|
||||||
|
|
||||||
|
@ -143,8 +144,8 @@ events.add("messageCreate", "codePreviews", async function (msg) {
|
||||||
|
|
||||||
let out = "";
|
let out = "";
|
||||||
const allFiles = files.join("\n").trim();
|
const allFiles = files.join("\n").trim();
|
||||||
if (allFiles !== "" && allFiles.length <= 2000) {
|
if (allFiles !== "" && allFiles.length <= 2000 && msg.channel.permissionsOf(hf.bot.user.id).has("manageMessages")) {
|
||||||
await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {});
|
await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS});
|
||||||
}
|
}
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
|
|
Loading…
Reference in a new issue