List of members with most recent messages

Hi!
I want to make an array in my discord bot with the most recent 20 members to send a message. How could I get such an array? Thank you so much!

Every time someone’s sends a message, you want to put them into array, unless if they exist already there, then update the item that stores that member, then to get 20 members that sent most recently message you want to sort it out by time and stop by 20th the most recent item, so you get 20 in total.

1 Like

Or you could just use the last method on the messages collection. msg.channel.messages.last(20)