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 ''))
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: