testing webhook and telegram library to see if it works

This commit is contained in:
Hosein
2025-12-24 14:40:38 +03:30
parent f1ce1c263d
commit b4c3ad40dc
2 changed files with 38 additions and 10 deletions
+6 -1
View File
@@ -7,11 +7,16 @@ def get_bot():
if _bot is None:
import telebot
BOT_TOKEN = os.environ.get("BOT_TOKEN")
_bot = telebot.TeleBot(BOT_TOKEN)
_bot = telebot.TeleBot(BOT_TOKEN, threaded=False) # threaded=False for serverless
# Register handlers
@_bot.message_handler(commands=["start"])
def start(message):
_bot.reply_to(message, "Welcome!")
# Add a handler for all other messages
@_bot.message_handler(func=lambda message: True)
def echo_all(message):
_bot.reply_to(message, f"You said: {message.text}")
return _bot