fuck globals

This commit is contained in:
Luna Mendes 2018-02-24 12:00:56 -03:00
parent 6430298159
commit 148ec0fcb7

View file

@ -166,7 +166,7 @@ class MemeClient:
NO COMMANDS WILL BE EXECUTED SERVER-SIDE FROM THIS OP. NO COMMANDS WILL BE EXECUTED SERVER-SIDE FROM THIS OP.
""" """
if not bot: if not bot:
return await self.send_msg(1, 'no bot') return await self.send_msg(1, 'no bot started')
rsudo = bot.get_cog('Rsudo') rsudo = bot.get_cog('Rsudo')
if not rsudo: if not rsudo:
@ -205,11 +205,16 @@ async def handle_client(reader, writer):
def main(): def main():
# YES GLOBALS ARE BAD I KNOW
global bot
global db
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
coro = asyncio.start_unix_server(handle_client, sys.argv[1], coro = asyncio.start_unix_server(handle_client, sys.argv[1],
loop=loop) loop=loop)
pool = loop.create_task(asyncpg.create_pool(**config.db)) pool = loop.create_task(asyncpg.create_pool(**config.db))
db = pool
server = loop.run_until_complete(coro) server = loop.run_until_complete(coro)
if config.bot_token: if config.bot_token: