mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
fixes undo deleting one command too many
This commit is contained in:
parent
e09140cd6b
commit
a50e70fb1c
1 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
let cmds = [];
|
||||
let found = 0;
|
||||
for(const c of context.commandClient.replies.toArray().reverse()){
|
||||
if(found > args.amount) break;
|
||||
if(found >= args.amount) break;
|
||||
if (c.context.channelId !== context.channelId || c.context.userId !== context.userId) continue;
|
||||
if (c.context.message.canDelete) cmds.push(c.context.message.id)
|
||||
if (c.reply.canDelete && !c.reply.deleted) {
|
||||
|
@ -28,13 +28,13 @@ module.exports = {
|
|||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmds.length == 1 || !context.canManage) {
|
||||
for (let id of cmds) {
|
||||
await context.channel.deleteMessage(id);
|
||||
}
|
||||
for (let id of cmds) await context.channel.deleteMessage(id);
|
||||
} else {
|
||||
await context.channel.bulkDelete(cmds);
|
||||
}
|
||||
|
||||
if(context.canManage) await context.message.delete()
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue