mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-11 12:21:37 +02:00
Remove Manage Messages perms requirement by only deleting own reactions
This commit is contained in:
parent
bd1d026d72
commit
257191b183
2 changed files with 12 additions and 10 deletions
|
@ -64,15 +64,17 @@ export default class {
|
|||
|
||||
this.isStopped = true;
|
||||
|
||||
if (str) {
|
||||
if (wasAlreadyStopped) {
|
||||
await this.msg.edit(str);
|
||||
} else {
|
||||
await Promise.all([this.msg.reactions.removeAll(), this.msg.edit(str)]);
|
||||
}
|
||||
} else {
|
||||
await this.msg.reactions.removeAll();
|
||||
}
|
||||
const editPromise = str ? this.msg.edit(str) : null;
|
||||
const reactPromise = str && !wasAlreadyStopped ? (async () => {
|
||||
await this.msg.fetch();
|
||||
await Promise.all(this.msg.reactions.cache.map(async react => {
|
||||
if (react.me) {
|
||||
await react.users.remove(this.msg.client.user!.id);
|
||||
}
|
||||
}));
|
||||
})() : null;
|
||||
|
||||
await Promise.all([editPromise, reactPromise]);
|
||||
|
||||
return this.msg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue