#[Help] How to clear 10 message from specific user?

1 messages · Page 1 of 1 (latest)

winged relic
high hatch
#

@winged relic wheres the problem?

winged relic
#

i dont have problem, i just want delete 10 message from user

#

but this method deleting all messages from user

high hatch
#

Should be a js not djs problem

#

Use a forEach func with a defined count

winged relic
#

i think i need filter by defined number when filtering message by

#

messages are here

high hatch
#

do you want to only delete 10 messages?

winged relic
#

yes but from specific user

high hatch
#

gimme a sec gonna try something

winged relic
#

okay, im waiting thank you for your help 🙂

high hatch
#
            let msgcounter = 0

            targetMessages.forEach(msg => {
                if(msgcounter >= 10) return; // Stop at 10 Messages
                msg.delete() // Delete Message
                msgcounter++ // 1+ When Message Deleted
            })
#

lmk if it works or if there is any problem with it @winged relic

winged relic
#

it's working, thank you sir.

high hatch
#

No problem