mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-23 09:15:29 +01:00
Merge pull request #311 from likuilin/master
Remove Manage Messages perms requirement by only deleting own reactions
This commit is contained in:
commit
1212ffc102
|
@ -96,7 +96,7 @@ export default class {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.client.on('ready', async () => {
|
this.client.on('ready', async () => {
|
||||||
console.log(`Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=36760640`);
|
console.log(`Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=36752448`);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.client.on('error', console.error);
|
this.client.on('error', console.error);
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default class {
|
||||||
|
|
||||||
if (reactionToRemove) {
|
if (reactionToRemove) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await reactionToRemove.remove();
|
await reactionToRemove.users.remove(this.msg.client.user!.id);
|
||||||
} else {
|
} else {
|
||||||
isRemoving = false;
|
isRemoving = false;
|
||||||
}
|
}
|
||||||
|
@ -64,15 +64,17 @@ export default class {
|
||||||
|
|
||||||
this.isStopped = true;
|
this.isStopped = true;
|
||||||
|
|
||||||
if (str) {
|
const editPromise = str ? this.msg.edit(str) : null;
|
||||||
if (wasAlreadyStopped) {
|
const reactPromise = str && !wasAlreadyStopped ? (async () => {
|
||||||
await this.msg.edit(str);
|
await this.msg.fetch();
|
||||||
} else {
|
await Promise.all(this.msg.reactions.cache.map(async react => {
|
||||||
await Promise.all([this.msg.reactions.removeAll(), this.msg.edit(str)]);
|
if (react.me) {
|
||||||
}
|
await react.users.remove(this.msg.client.user!.id);
|
||||||
} else {
|
}
|
||||||
await this.msg.reactions.removeAll();
|
}));
|
||||||
}
|
})() : null;
|
||||||
|
|
||||||
|
await Promise.all([editPromise, reactPromise]);
|
||||||
|
|
||||||
return this.msg;
|
return this.msg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue