ruz-bot/daemons/bot.py
2023-11-11 12:58:51 +03:00

25 lines
591 B
Python

import os
import telebot
from telebot.types import Message
import settings
from helpers.mongo import mongo
from helpers.platform import platform
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
@bot.message_handler(commands=['start'])
def on_start(message: Message):
mongo.users_collection.delete_many({"chat_id": message.chat.id})
do_action(message)
@bot.message_handler()
def do_action(message: Message):
if settings.STAGE == 'development' and not platform.get_staff(message.chat.id):
return
from helpers.answer import Answer
Answer(message).process()