28 lines
658 B
Python
28 lines
658 B
Python
import telebot
|
|
import os
|
|
|
|
from daemons import base
|
|
from utils import queues
|
|
|
|
|
|
class Daemon(base.BaseDaemon, queues.TasksHandlerMixin):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
|
|
|
|
@property
|
|
def queue_name(self):
|
|
return 'pizda_bot_mailbox'
|
|
|
|
def execute(self):
|
|
self.poll()
|
|
|
|
def process(self, payload):
|
|
body = {
|
|
'chat_id': payload['chat_id'],
|
|
'text': payload['message'],
|
|
}
|
|
if payload['action'] == 'reply':
|
|
body['reply_to_message_id'] = payload['reply_to']
|
|
self.bot.send_message(**body)
|