ptbstats.SimpleStats¶
-
class
ptbstats.
SimpleStats
(command, check_update)¶ Bases:
Generic
[telegram.ext.handler.UT
],abc.ABC
Simple implementation of
ptbstats.BaseStats
collecting records per day and user. The command callback will run asynchronously.-
command
¶ The command that produces the statistics associated with this instance.
-
records
¶ For each
datetime.date
, the dict value is a dict, containing for each user the number of recorded inline queries.
- Parameters
command (
str
) – The command that should produce the statistics associated with this instance.check_update (
Callable
[[Update
],Optional
[bool
]]) – A callable that determines, if an update should be handled or not. Seeptbstats.BaseStats.check_update()
for the details.
-
check_update
(update)¶ This method is called to determine if an update should be processed by this statistics instance. It must always be overridden.
Note
You can imitate Filters by this method by something like:
def check_update(self, update: Update): return update.effective_message and (Filters.text | Filters.sticker)(update)
-
process_update
(update)¶ Counts the number of queries per user and day.
- Parameters
update (
Update
) – Thetelegram.Update
.- Return type
-
reply_statistics
(update, context)¶ Sends one PDF-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
-