🔮✨ Create a Telegram Reaction Bot | Easy Tutorial by @TraxDinosaur 🤖💫

 

 

Telegram Reaction Bot

 




 Code:
'''
TELEGRAM REACTION BOT TUTORIAL
GitHub: TraxDinosaur
Replit: TraxDinosaur
Instagram: @TraxDinosaur
YouTube: @TraxDinosaur
Blog: TraxDinosaurs
'''
import logging
from telegram import Update, Bot, ReactionTypeEmoji
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, CallbackContext, MessageHandler, filters
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
async def start(update:Update, context:ContextTypes.DEFAULT_TYPE):
await context.bot.send_message(chat_id=update.effective_chat.id,text="This is a reaction bot.")
async def reaction(update: Update, context: CallbackContext):
emoji = "😱"
chat_id = update.message.chat_id
message_id = update.message.message_id
await context.bot.set_message_reaction(chat_id,message_id,reaction=ReactionTypeEmoji(emoji))
print("Bot Is Working")
app = ApplicationBuilder().token("YOUR_BOT_TOKEN").build()
start_handler = CommandHandler('start', start) # "Start" Is A Command Name We Use In Telegram Using / & The Second Is We Providing A Function To Perform
app.add_handler(start_handler)
react_handler = MessageHandler(filters.TEXT & ~filters.COMMAND, reaction)
app.add_handler(react_handler)
app.run_polling()
view raw ReactionBot.py hosted with ❤ by GitHub
 


Post a Comment

0 Comments