Tgbotstat is a Python package that allows you to follow and save statistics for using your TELEGRAM bot. It can save the number of uses of each order, users who have used these commands, the hours to which commands are used, and more.
You can install Tgbotstat using pip . Make sure you have pip installed, then run the following command:
pip install tgbotstatOnce you have installed Tgbotstat , you can import it into your Python code to monitor and save use statistics. Here's how you can use it in your project:
from tgbotstat import *
# Charger les statistiques existantes
statistiques = charger_statistiques ()
# Mettre à jour les statistiques pour une commande
commande = "/start"
user_id = 12345
heure_commande = "14"
jour_semaine = "Lundi"
mettre_a_jour_statistiques_commande ( statistiques , commande , user_id , heure_commande , jour_semaine )
# Enregistrer de nouvelles statistiques
sauvegarder_statistiques ( statistiques )
# Afficher les données d'utilisation
stats_text = "Statistiques d'utilisation des commandes: n "
for date , commands in statistiques [ 'commands' ]. items ():
stats_text += f" n Date: { date } n "
for command , data in commands . items ():
nombre_utilisations = data [ 'nombre_utilisations' ]
utilisateurs_commande = len ( data [ 'utilisateurs' ])
heures = data . get ( 'heures' , {})
heures_text = ', ' . join ([ f" { heure } : { utilisations } utilisations" for heure , utilisations in heures . items ()])
stats_text += f"- { command } : { nombre_utilisations } utilisations par { utilisateurs_commande } utilisateurs ( { heures_text } ) n "
print ( stats_text )You can also use other functions and classes exposed by the package, such as loading_utilizers , save_Utilizer , follow_commandes_popular , etc., to personalize your statistics according to your needs.
Contributions are welcome! If you want to improve tgbotstat or add new features, do not hesitate to open an extraction request (request sweater) or report problems (from) on https://github.com/codingtoto/tgbotstat.
We plan to add several features and improvements to tgbotstat in future versions. Here is an overview of the planned work:
We are open to community suggestions and contributions. If you have improvement ideas or new features that you would like to see in tgbotstat , do not hesitate to open a way out or offer a request for our restitory github.
Do not hesitate to follow our development and contribute to improving this package. We can't wait to see how tgbotstat will evolve in the future!
This project is under MIT license. For more information, see the License file.