Spaces:
Runtime error
Runtime error
Create telegram_bot.py
Browse files- telegram_bot.py +17 -0
telegram_bot.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import telebot
|
2 |
+
from app import chatbot # Ye app.py ka chatbot function import karega
|
3 |
+
|
4 |
+
# Telegram bot token
|
5 |
+
TOKEN = "7881901341:AAEaE5gndeORmCuyzSwOyf2ELFLXHneCpiw"
|
6 |
+
bot = telebot.TeleBot(TOKEN)
|
7 |
+
|
8 |
+
# Message handle karna
|
9 |
+
@bot.message_handler(func=lambda message: True)
|
10 |
+
def handle_message(message):
|
11 |
+
user_input = message.text
|
12 |
+
bot_reply = chatbot(user_input)
|
13 |
+
bot.send_message(message.chat.id, bot_reply)
|
14 |
+
|
15 |
+
# Bot start karna
|
16 |
+
print("🤖 Telegram bot running...")
|
17 |
+
bot.polling()
|