]> git.somenet.org - pub/jan/mattermost.git/blob - somebot/command_stats_printer.py
[somebot] /join-all
[pub/jan/mattermost.git] / somebot / command_stats_printer.py
1 #!/usr/bin/env python3
2 #
3 # Mattermost Bot.
4 #  Copyright (c) 2016-2020 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
5 #  published under MIT-License
6 #
7 # This is started by the init script.
8 #
9
10 import json
11
12 try:
13     with open("/tmp/somebot_command_stats.json", "r", encoding="utf-8") as f:
14         stats = json.load(f)
15         for c, count in sorted(stats.items()):
16             print(c+" ["+str(count)+"]")
17 except FileNotFoundError:
18     pass