Hello, Welcome To Technostone.xyz hope you will be fine. Today we are going to learn how to install the Telegram bot statics system in your bot. Maybe you will be our other article profession in which we told how you can create Telegram bot on bots.business. So this article is also related to it. We are going to add a command to the bot, with the help of which you can see the Statistics of the Telegram bot.
What is Telegram Bot Statistics
What is Statistics? If you do Telegram, you will know that if we watch any Telegram channel, we have a number shown above. Those numbers tell that how many members are ad or join this telegram channel. Similarly, in the Telegram group, you must have seen how many members are joining this group, but you do not get to see this feature in Telegram bot. How many users are using your Telegram bot? So Telegram bot Statistics is used to find out how many users are using Telegram bot total.
How to Add Telegram Bot Statistics
To add Statistics to Telegram bot, you should have already told a bot if you do not know how to make a Telegram bot, then you can read the article given below.
If you have learned to create a Telegram bot. So the next step is given below how you can get Telegram bot statistics.
First of all, you must have done your bot on Bots.business. and will be working properly. So you just have to copy-paste some commands and BJS codes given below.
You Need to Install Some Libs Like : ResourcesLib
Here below you will find a BJS code. You have to paste this code into the code of your /start command.
Which you will also get to see in the image below.
- Advertisement -
var use = Libs.ResourcesLib.anotherChatRes("use", "global") use.add(1)
After this, you have to add a new command to your Bots.business
Command Name : /state
var use = Libs.ResourcesLib.anotherChatRes("use", "global") Bot.sendMessage("*📊 Bot Live Statisticsnn👥 Users = "+use.value()+" Users*")
- Advertisement -
It is completely ready now. If you want to do this, then run the /state command in your boat and you will get to see the details of how many users have started this boat that means they are doing it.
This code will work only if you have added this code. Meaning if you are already running your bot. So it will not give the details of old users. It will give only the details of the new users who will start the bot.
This code tells how many times a command has been executed. Meaning that if any user wants to use the boat, then he will have to start it first. So this is the code given above. He will trace the start command that how many users have started this boat. This is not an official code but you can easily get the statics of your bot.
You can do this code in another way as if you have any other command, if I talk about URL shortener boat for example, then you can do this code on that too. The details of how many URLs have been shortened in the URL shortener can be extracted.
If you want to show this statics to your user also then you have to generate a keyboard like
Add In Keyboard ,📊 Statistics
As if your command is run on success only then you can put this code in the success command. Below you will find the example code.
You should read this article to understand it
The Bitly URL Shortener bot has the success command /onShort. Meaning that this command will run only when we get the short link. Either we will get an error, when we get the short link, we will paste this code on it that you can see in the image.
var links = Libs.ResourcesLib.anotherChatRes("links", "global") links.add(1)
- Advertisement -
After pasting this code in /onShort, the second command will remain the same as given earlier, only you will have to change the name of the property.
Command Name: /state
var use = Libs.ResourcesLib.anotherChatRes("use", "global") var links = Libs.ResourcesLib.anotherChatRes("links", "global") Bot.sendMessage("*📊 Bot Live Statisticsnn👥 Users = "+use.value()+" Usersnn🔗 Links = "+links.value()+"*")
I hope you would have understood. If you don’t understand then you can watch this video