Spaces:
Runtime error
Runtime error
Create telegram_bot.py
Browse files- telegram_bot.py +12 -0
telegram_bot.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import telebot
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
TOKEN = "7881901341:AAEaE5gndeORmCuyzSwOyf2ELFLXHneCpiw"
|
| 5 |
+
bot = telebot.TeleBot(TOKEN)
|
| 6 |
+
|
| 7 |
+
@bot.message_handler(func=lambda message: True)
|
| 8 |
+
def chat(message):
|
| 9 |
+
response = requests.get(f"https://syedmoinms.hf.space/chat?msg={message.text}").json()
|
| 10 |
+
bot.reply_to(message, response["response"])
|
| 11 |
+
|
| 12 |
+
bot.polling()
|