42 lines
852 B
Python
42 lines
852 B
Python
import asyncio
|
|
from os import getenv
|
|
|
|
import util
|
|
from sources.ch4 import Chan4
|
|
from sources.dis import DiscordClient
|
|
|
|
# For development
|
|
if not getenv("DISCORD_TOKEN", None):
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
log = util.get_logger("monolith")
|
|
|
|
modules_enabled = getenv("MODULES_ENABLED", False)
|
|
|
|
token = getenv("DISCORD_TOKEN", None)
|
|
if not token:
|
|
raise Exception("No Discord token provided")
|
|
|
|
|
|
async def main(loop):
|
|
log.info("Starting Discord handler.")
|
|
client = DiscordClient()
|
|
loop.create_task(client.start(token))
|
|
#client.run(token)
|
|
|
|
log.info("Starting 4chan handler.")
|
|
chan = Chan4()
|
|
await chan.run()
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
|
loop.create_task(main(loop))
|
|
#reactor.run()
|
|
try:
|
|
loop.run_forever()
|
|
except KeyboardInterrupt:
|
|
log.info("Process terminating")
|
|
finally:
|
|
loop.close()
|