Determine if someone is an active chatter

Hundreds of usernames and timestamps might seem like much, but really isn’t. Since it is only important to gather if a user has posted it’s latest message within a given time frame, the list would only have to contain recent posters and discard the old. Even on the biggest channels I don’t think that would take much resources.

In an associative array I would use username as the key and timestamp as the value. Each time a user posts, an assignment of their username would either assign or overwrite your previous timestamp.

Checking is as simple as iterating over the list and discard each user key with a timestamp that is too old. The remaining keys are all the active chatters within your time frame.

Edit: Use the delete operator to remove keys, so that the list won’t keep growing

1 Like