Hello, friends welcome to a new article today. Today in this article I will tell you how you can force your Telegram bot user to join the Telegram channel. Meaning that if you have developed a Telegram bot. So the user who starts that boat, then there is a show of force subscribe in front of them. If that user does not join the Telegram channel, then the Telegram bot will not start. Meaning the bot that has been created will not be able to use it.
All this we will apply on bots hosted on bots.business means that if your Telegram bot is hosted on bots.business then we have created some code for that. With the help of which they can install force subscribe feature in their Telegram bot.
In bots.business it is called membership checker panel. This code will check the particular user who is using your telegram bot in your channel whether this user has joined this telegram channel or not, if the user has not joined the telegram channel, he will show an error to the user. If the user has joined the channel, he will simply continue the Telegram bot.
To apply this in your Telegram bot, you must already have a Telegram bot created, that too if it is not on bots.business. And if you do not know how to create, then you can read the article given below.
We have created many telegram bots, out of which we will use the bitly URL shortener bot as an example so that you can understand how to do this bjs code
This code will work only on telegram bot hosted on bots.business
How To Force Subscribe Telegram Bot User To A Telegram Channel
Here you will find some codes, all you have to do is copy-paste them and your Force Subscribe Telegram bot feature will be created.
If you want to add Force Subscribe to the Telegram bot, then first you have to change the /start command, if you want, you can simply copy-paste it. Either you can paste this code anywhere by yourself.
For Single Add Telegram Channel Force Subscribe
First You Change Code In /start Command
Command Name : /start
In the start command, you only have to change the name of the next command you want to run. Meaning that the command you will run next has to be changed. If you don't understand then you can watch the video below
After that you have to add 2 more commands, you will get the command name and BJS code below
Command Name: Join
BJS CODE
let stat = Bot.getProperty(""+user.telegramid+""); if (stat=="ban") { Bot.sendMessage("*You're Ban From Using The Bot ❌*"); }else{ let channel = "Your Channel Username"; let id = user.telegramid Api.getChatMember({ chat_id : channel, user_id : id, on_result :"Check"}) }
Command Name: Check
BJS CODE:
var user = options.result.status; User.setProperty("status" , user, "string"); if (user=="member" | user =="administrator" | user=="creator"){ Bot.runCommand("main_menu") User.addToGroup("user") } if (user=="left"){ Bot.sendMessage("*❌ Must Join (Your Channel Name) Channel*") }]
If you want to add multiple channels, then for that you have to add a command from one agar which you will get below.
For Multiple Add Telegram Channel Force Subscribe
let stat = Bot.getProperty(""+user.telegramid+""); if (stat=="ban"){ Bot.sendMessage("*You're Ban From Using The Bot ❌*"); }else{ var chan1 = "Channel 1"; var chan2 = "Channel 2"; var chan3 = "Channel 3"; let id = user.telegramid Api.getChatMember({ chat_id : chan1,chan2,chan3, user_id : id, on_result :"check"}) }
var user = options.result.status; User.setProperty("status" , user, "string"); if (user=="member" | user =="administrator" | user=="creator"){ Bot.runCommand("Main_Menu") User.addToGroup("user") } if (user=="left"){ Bot.sendMessage("*❌ Must Join All Channel*") }
After adding this code, you will have to make your bot an admin in the channel, only then it will work.