accept custom sockfile

This commit is contained in:
Luna Mendes 2017-12-03 01:55:40 -03:00
parent 9834820efe
commit 62f98be69d
3 changed files with 9 additions and 5 deletions

2
.gitignore vendored
View file

@ -102,3 +102,5 @@ venv.bak/
# mypy # mypy
.mypy_cache/ .mypy_cache/
config.py

View file

@ -67,7 +67,10 @@ class Rsudo(Cog):
return discord.utils.get(_user.roles, id=self.bot.config.admin_role) is not None return discord.utils.get(_user.roles, id=self.bot.config.admin_role) is not None
reaction, admin = await self.bot.wait_for('reaction_add', check=check) reaction, admin = await self.bot.wait_for('reaction_add', check=check)
try:
await msg.clear_reactions() await msg.clear_reactions()
except:
log.error('can not remove reactions')
should_execute = emoji.get(reaction.emoji) should_execute = emoji.get(reaction.emoji)

View file

@ -8,14 +8,13 @@ import asyncio
import struct import struct
import json import json
import logging import logging
import sys
import asyncpg import asyncpg
import config import config
from bot import schedule_bot from bot import schedule_bot
SOCKFILE = './memed.succ'
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
db = None db = None
@ -117,7 +116,7 @@ async def handle_client(reader, writer):
if __name__ == '__main__': if __name__ == '__main__':
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
coro = asyncio.start_unix_server(handle_client, SOCKFILE, coro = asyncio.start_unix_server(handle_client, sys.argv[1],
loop=loop) loop=loop)
db = loop.run_until_complete(asyncpg.create_pool(**config.db)) db = loop.run_until_complete(asyncpg.create_pool(**config.db))