They did a raid. If a cai started write the !city script a line in sql table. You can see it in log if you type !city. I only count the started cais of a player.Its a simple SQL command.
For the chat i write ever written line in sql DB. (On large chat bots it can be an overheap) And count it again at every !info command.