Browse Source

add simple system to ignore users

encrypt 4 years ago
parent
commit
84b7115fc7
1 changed files with 9 additions and 2 deletions
  1. 9 2
      mumble-bot/bot.py

+ 9 - 2
mumble-bot/bot.py

@@ -54,6 +54,12 @@ def get_parser():
         help="Set tokens list",
         nargs="*"
     )
+    parser.add_argument(
+        "--ignore",
+        help="List of ignored users",
+        nargs="*",
+        default=[]
+    )
     return parser
 
 
@@ -71,7 +77,8 @@ def main():
     tokens = args.tokens
     is_streaming = False
     stream_always = args.stream
-
+    ignored_users = args.ignore
+    
     # Spin up a client and connect to mumble server
     mumble = pymumble.Mumble(server, nick, password=pwd, port=port, tokens=tokens)
 
@@ -102,7 +109,7 @@ def main():
 
             try:
                 for user in mumble.users.values():  # check the audio queue of each user
-                    if user.sound.is_sound():
+                    if user.sound.is_sound() and user["name"] not in ignored_users:
                         # available sound is to be treated now and not later
                         sound = user.sound.get_sound(FLOAT_RESOLUTION)
                         stereo_pcm = audioop.tostereo(sound.pcm, 2, 1, 1)