2018-08-10 19:19:38 +00:00
|
|
|
import asyncio
|
|
|
|
import aiohttp.web
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from . import app
|
2018-08-11 01:36:24 +00:00
|
|
|
from .irc import irc_bot
|
2018-08-10 19:19:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def start_webserver():
|
|
|
|
runner = aiohttp.web.AppRunner(app)
|
|
|
|
await runner.setup()
|
|
|
|
|
|
|
|
logging.info('Starting webserver at localhost:8080')
|
|
|
|
|
|
|
|
site = aiohttp.web.TCPSite(runner, 'localhost', 8080)
|
|
|
|
await site.start()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
asyncio.ensure_future(start_webserver())
|
2018-08-11 01:36:24 +00:00
|
|
|
asyncio.ensure_future(irc_bot())
|
2018-08-10 19:19:38 +00:00
|
|
|
loop.run_forever()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|