From: CMDR furrycat Date: Wed, 25 Nov 2020 09:04:37 +0000 (+0100) Subject: Lint. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=1485778e1c8b891e952fec9fff3fc58e01762c01;p=furrycat%2Fcatbot.git Lint. --- diff --git a/bot.py b/bot.py index 969b547..b93955a 100644 --- a/bot.py +++ b/bot.py @@ -40,14 +40,14 @@ def is_admin(user, server = None, context = None): params.append(server.id) if context is not None: params.append(context) - sql = 'select id from admins where server_id in ({}) and bot_id in (?, ?) and user_id=?'.format(', '.join(['?'] * len(params))) + sql = 'select count(*) from admins where server_id in ({}) and bot_id in (?, ?) and user_id=?'.format(', '.join(['?'] * len(params))) params.append('global') params.append(client.user.id) params.append(user.id) cursor = db.query(sql, params) - for row in cursor.fetchall(): + row = cursor.fetchone() + if row and row[0] > 0: ret = True - break db.close_db() tb = reversed(traceback.extract_stack()[0:-2]) log.info('{}: User {} {} an administrator{}'.format(': '.join([format_frame(frame) for frame in tb]), user.name, 'is' if ret else 'is not', ' on server {}'.format(server.name) if server is not None else '')) @@ -589,7 +589,7 @@ async def maybe_say(channel, text, *, typing = None, attachment = None, embed = try: ok = True send = {} - async with typing_context_manager(channel, typing) as context_manager: + async with typing_context_manager(channel, typing): if embed: send['embed'] = embed if attachment is not None: