]> asedeno.scripts.mit.edu Git - vt_decor.git/commitdiff
rework auth char to dict lookup, add discord bridge
authorAlejandro R. Sedeño <asedeno@mit.edu>
Mon, 14 Nov 2022 20:21:47 +0000 (15:21 -0500)
committerAlejandro R. Sedeño <asedeno@mit.edu>
Mon, 14 Nov 2022 20:21:47 +0000 (15:21 -0500)
vt_decor.py

index 602f496f61d43aa64300f9628cd377430b9365aa..1d88d38f3e0d64ba71a488dcd0b85976b2365e9d 100644 (file)
@@ -244,9 +244,16 @@ class RoostVTDecor(roost.RoostMessage.Decor):
             dest = klass
         else:
             dest = f'{klass}[{inst}]'
-        auth = '+' if msg.data['auth'] else '-'
-        if not msg.data['auth'] and  msg.data['opcode'] == 'mattermost':
-            auth = '¤'
+        if msg.data['auth']:
+            auth = '+'
+        else:
+            try:
+                auth = {
+                    'mattermost': '¤',
+                    'discord': '¬',
+                }[msg.data['opcode']]
+            except KeyError:
+                auth = '-'
         t = time.strftime(
             '%H:%M:%S' if SETTINGS['show_seconds'] else '%H:%M',
             time.localtime(msg.data[SETTINGS['time']] / 1000))