Show non shared IDs if --admin flag is user by admin.
authorCMDR furrycat <elite@furrycat.net>
Tue, 5 Dec 2017 09:42:08 +0000 (09:42 +0000)
committerCMDR furrycat <elite@furrycat.net>
Tue, 5 Dec 2017 09:42:08 +0000 (09:42 +0000)
bot.py
plugin/developer/developer.py

diff --git a/bot.py b/bot.py
index 986e728..0664452 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -143,12 +143,12 @@ def unparse_seconds(seconds):
     interval += '{}s'.format(seconds)
   return interval
 
-def shared_with(user, instance):
+def shared_with(user, instance, allow_admin_override = True):
   if user is None:
     return True
   if user.id == client.user.id:
     return True
-  if is_admin(user):
+  if allow_admin_override and is_admin(user):
     return True
 
   if type(instance) == discord.server.Server:
index 24efc0a..2d54225 100644 (file)
@@ -144,6 +144,7 @@ class Developer(object):
     server_id = None
 
     ap = ThrowingArgumentParser()
+    ap.add_argument('--admin', action='store_true')
     ap.add_argument('--channel', '--channels', action='store_true')
     ap.add_argument('--member', '--members', action='store_true')
     ap.add_argument('--role', '--roles', action='store_true')
@@ -235,4 +236,4 @@ class Developer(object):
             continue
           results.append(server)
 
-    yield from bot.say_many(message.channel, ['{} {} {}{}'.format(Identify.string(result), result.id, result.name, ' {}'.format(result.joined_at) if type(result) == discord.member.Member else '') for result in set(results) if bot.shared_with(message.author, result)])
+    yield from bot.say_many(message.channel, ['{} {} {}{}'.format(Identify.string(result), result.id, result.name, ' {}'.format(result.joined_at) if type(result) == discord.member.Member else '') for result in set(results) if bot.shared_with(message.author, result, allow_admin_override = bool(parsed.admin))])