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

4
.gitignore vendored
View file

@ -101,4 +101,6 @@ venv.bak/
/site
# 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
reaction, admin = await self.bot.wait_for('reaction_add', check=check)
await msg.clear_reactions()
try:
await msg.clear_reactions()
except:
log.error('can not remove reactions')
should_execute = emoji.get(reaction.emoji)

View file

@ -8,14 +8,13 @@ import asyncio
import struct
import json
import logging
import sys
import asyncpg
import config
from bot import schedule_bot
SOCKFILE = './memed.succ'
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
db = None
@ -117,7 +116,7 @@ async def handle_client(reader, writer):
if __name__ == '__main__':
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)
db = loop.run_until_complete(asyncpg.create_pool(**config.db))