Add management command to set Telegram token

This commit is contained in:
Kumi 2020-12-31 22:29:26 +01:00
parent 6c91c70d17
commit c25cac1ac2

View file

@ -0,0 +1,13 @@
from django.core.management.base import BaseCommand, CommandError
from dbsettings.functions import dbsettings
class Command(BaseCommand):
help = 'Set your Telegram token'
def handle(self, *args, **options):
token = input("Enter the token you received from the @BotFather: ")
dbsettings["TELEGRAM_TOKEN"] = token
self.stdout.write(self.style.SUCCESS('Telegram token set successfully.'))