0% found this document useful (0 votes)
160 views

Script Python Bot Telegram

This document contains code for a Telegram bot that greets users with a welcome message when they use the /start command in a specific group. The bot imports the necessary libraries, defines a welcome text template with formatting, and includes a message handler that gets the user's first and last name to populate the template and sends the customized welcome message in HTML format to the group chat.

Uploaded by

Unknown Server
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views

Script Python Bot Telegram

This document contains code for a Telegram bot that greets users with a welcome message when they use the /start command in a specific group. The bot imports the necessary libraries, defines a welcome text template with formatting, and includes a message handler that gets the user's first and last name to populate the template and sends the customized welcome message in HTML format to the group chat.

Uploaded by

Unknown Server
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import telebot

import os
import sys
from colored import fg, bg, attr
color = bg('indian_red_1a') + fg('white')

api = 'INPUT YOUR API TELEGRAM HERE'


bot = telebot.TeleBot(api)

text_messages = {

'welcome':
'Selamat Datang!' ' '
'<b>{name} {name1}.</b>' ' ' 'Welcome to join this group!',
}

@bot.message_handler(commands=['start'])
def send_welcome(message):
check_reply = message.reply_to_message
reply = str(check_reply)
name = message.from_user.first_name
name1 = message.from_user.last_name
texxt = message.text.lower()
no_id = str(message.chat.id)
group_id = message.chat.id
if no_id == 'YOUR ID GROUP BOT' :
bot.send_message(message.chat.id,
text_messages['welcome'].format(name=name, name1=name1), parse_mode="HTML")

You might also like