Open Source Bot Telegram By @RasiTechChannel1
This PHP code provides a Telegram bot that sends a welcome message to new members when they join a group. The bot also responds with usage information when users send the "/start" command.
- PHP server
- Telegram bot token (obtained from BotFather)
- Replace
TOKEN_BOT_TELEGRAM
in the code with your actual Telegram bot token. - Deploy the code to a server accessible by Telegram.
- Set up a webhook to receive messages using tools like ngrok (for local development) or a public server.
- Start the bot and invite it to your Telegram group.
- When a new member joins the group, the bot will send a welcome message along with their profile photo.
- Send the "/start" command to the bot to receive information about its usage.
- The code uses the Telegram Bot API to send messages and retrieve user information.
- The
sendMessage
function sends a text message to a specified chat ID. - The
sendPhotoWithCaption
function sends a photo with a caption to a specified chat ID. - The script checks for two scenarios: receiving a message or new members joining the group.
- If the received message is "/start", the bot sends usage information.
- If new members join the group, the bot retrieves their profile photos and sends a welcome message with the photo.
Feel free to customize the welcome message, usage information, or any other part of the code to fit your requirements.
Note: Make sure to keep your bot token confidential and secure.