bot to django command
This commit is contained in:
parent
5fd4823740
commit
36d4931312
@ -1,5 +1,5 @@
|
|||||||
import telebot
|
import telebot
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
bot = telebot.TeleBot("1994460106:AAGrGsCZjF6DVG_T-zycELuVfxnWw8x7UyU")
|
bot = telebot.TeleBot("1994460106:AAGrGsCZjF6DVG_T-zycELuVfxnWw8x7UyU")
|
||||||
|
|
||||||
@ -10,7 +10,10 @@ def do_action(message):
|
|||||||
bot.send_message(chat_id=message.chat.id, text=f"ID чата: {message.chat.id}")
|
bot.send_message(chat_id=message.chat.id, text=f"ID чата: {message.chat.id}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
class Command(BaseCommand):
|
||||||
print('bot is starting')
|
help = 'starts bot'
|
||||||
bot.polling()
|
|
||||||
print('bot failed')
|
def handle(self, *args, **options):
|
||||||
|
print('bot is starting')
|
||||||
|
bot.polling()
|
||||||
|
print('bot failed')
|
@ -36,7 +36,7 @@ services:
|
|||||||
bot:
|
bot:
|
||||||
image: sprint
|
image: sprint
|
||||||
restart: always
|
restart: always
|
||||||
command: python bot.py
|
command: python manage.py bot
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
- web
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user