ptbstats.SimpleStats#
- class ptbstats.SimpleStats(command, check_update)#
Simple implementation of
ptbstats.BaseStatscollecting records per day and user. The command callback will run non-blocking.- Parameters:
- command#
The command that produces the statistics associated with this instance.
- records#
For each
datetime.date, the dict value is an object with two attributesuser_idsandqueries.user_idsis a set of all user ids that where recorded on that day.queriesis the total amount of recorded queries on that day.
- check_update(update)#
- load_data(application)#
Loads the data stored by
store_data(). Assumes thatcontext.bot_datais a dict and loads the data fromapplication.bot_data['SimpleStats']. Override to customize the behavior.- Return type:
- async process_update(update)#
Records the update.
- Parameters:
update (
Update) – Thetelegram.Update.- Return type:
- async reply_statistics(update, context)#
Sends one HTML-file with the two graphs of number of users per day and number of queries per day as reply.
- Parameters:
update (
Update) – Thetelegram.Update.context (
CallbackContext) – Thetelegram.ext.CallbackContext
- Return type: