I have a situation where bot says repeating messages from some other program like this (always the same text but somenick is different) : <botname> admin request by somenick

Now what I have to do is check if the above line will come 5 times in a row (somenick is spamming the adminreq command). If he repeats it 5 times then the somenick will get banned.

I know how to make that banning part and on TEXT part, but I don't have a clue where to start with that loop check (5 times in a row).

Please can someone explain this to me how can i check this?

TIA