I think it's probably better to store segments of 10 seconds each for a script like this. A KPM meter on twitch usually refers to not whole-stream session but rather current time session.
Pseudo code:
Check text for Kappa
If match: Increase variable once per each kappa
- Add variable to storage with others that occured within last 10 seconds
On !kpm: check time, take time from 60 seconds ago until now's variables
Divide variables' amounts by 60.
But I agree. It's nonsense. And almost a bit rude of a request.