silent-bot.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. import pymumble_py3 as pymumble
  2. import subprocess as sp
  3. from time import sleep
  4. import sys
  5. import os
  6. import fcntl
  7. import pyaudio
  8. pwd = "" # password
  9. server = "mumble.esiliati.org" # server address
  10. nick = "TubiaBotSilente"
  11. channel = "radiospore_onair"
  12. port = 64738 # port number
  13. # pyaudio set up
  14. CHUNK = 1024
  15. FORMAT = pyaudio.paInt16 # pymumble soundchunk.pcm is 16 bits
  16. CHANNELS = 1
  17. RATE = 48000 # pymumble soundchunk.pcm is 48000Hz
  18. # Spin up a client and connect to mumble server
  19. mumble = pymumble.Mumble(server, nick, password=pwd, port=port)
  20. # set up callback called when PCS event occurs
  21. mumble.set_receive_sound(0) # Enable receiving sound from mumble server
  22. mumble.start()
  23. mumble.is_ready() # Wait for client is ready
  24. mumble.channels.find_by_name(channel).move_in()
  25. #mumble.users.myself.mute()
  26. # constant capturing sound and sending it to mumble server
  27. while True:
  28. mumble.sound_output.add_sound(bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))