minecraft_manager/assets/bots/Discord-MCM.bot.py

22 lines
515 B
Python
Raw Normal View History

2019-08-27 20:44:20 +00:00
import os
import sys
import django
2018-09-20 02:56:17 +00:00
sep = os.sep
path = os.path.dirname(os.path.abspath(__file__))
path = path.split(sep)[:-3]
project = path[-1]
path = sep.join(path)
sys.path.append(path)
print("Setting path for {0}: {1}".format(project, path))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{}.settings".format(project))
django.setup()
from django.conf import settings
2019-08-27 20:44:20 +00:00
from minecraft_manager.bot.discord import Discord
2018-09-20 02:56:17 +00:00
token = getattr(settings, 'DISCORD_BOT_TOKEN', None)
bot = Discord(token)
2019-08-27 20:44:20 +00:00
2018-09-20 02:56:17 +00:00
bot.run_bot()