ptbstats.SimpleStats#
- class ptbstats.SimpleStats(command, check_update)#
Simple implementation of
ptbstats.BaseStats
collecting 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_ids
andqueries
.user_ids
is a set of all user ids that where recorded on that day.queries
is 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_data
is 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: