Asgarrrr / Luna

An adorable discord bot fully customizable created in javascript, using Discord.js and mongoDB that is constantly growing !
https://lunadoc.vercel.app/
GNU General Public License v3.0
24 stars 3 forks source link

Prune issue : Cannot read property 'id' of undefined #22

Closed MilkFlavor closed 3 years ago

MilkFlavor commented 3 years ago

Does this do anything? The error left after removing this line.

if (removed.size > 0) { this.client.db.prepare("INSERT INTO Event('Type', 'DATA') VALUES(?, ?)").run( "PRUNE", JSON.stringify({ by: message.author.id, deleted: removed.map((x) => x.id) }), ); }

TypeError: Cannot read property 'id' of undefined at /home/user/Documents/Luna-master/Commands/Moderation/prune.js:75:95 at /home/user/Documents/Luna-master/node_modules/@discordjs/collection/dist/index.js:220:20 at Function.from () at Map.map (/home/user/Documents/Luna-master/node_modules/@discordjs/collection/dist/index.js:218:22) at /home/user/Documents/Luna-master/Commands/Moderation/prune.js:75:82 at processTicksAndRejections (node:internal/process/task_queues:94:5) at async Prune.run (/home/user/Documents/Luna-master/Commands/Moderation/prune.js:67:9)

The bot doesn't erase the amount of messages as specified. If I tell it to delete 69 messages it only deletes 37.

Asgarrrr commented 3 years ago

If I tell it to delete 69 messages it only deletes 37.

A bot cannot delete messages older than 2 weeks.

Asgarrrr commented 3 years ago

It makes no sense, but the problem is solved.