forked from itsyogieu/ybwelcomebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
31 lines (22 loc) · 981 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from telegram import Update
from telegram.ext import Updater , CommandHandler, CallbackQueryHandler, CallbackContext,Filters,MessageHandler
import os
Token =os.environ.get("BOT_TOKEN",None)
updater = Updater( Token ,use_context = True )
def start(updater,context):
updater.message.reply_text('''Hi iam welcome messanger bot
Add me to your group
Made with Love ❤️ by @TechMagazineYT
''')
def help(updater,context):
updater.message.reply_text("Add me to your group ")
def add_group(update: Update, context: CallbackContext):
for member in update.message.new_chat_members:
update.message.reply_text(f'Hello {member.full_name} , Welcome to TM support Thank you for Joining ')
add_group_handle = MessageHandler(Filters.status_update.new_chat_members, add_group)
updater.dispatcher.add_handler(add_group_handle)
dp =updater.dispatcher.add_handler
dp(CommandHandler('start',start))
dp(CommandHandler('help',help))
updater.start_polling()
updater.idle()