fix: avoid confusing error message when connection to the murmur server fails.
This commit is contained in:
parent
a58af46f15
commit
fbe3383b66
@ -13,6 +13,7 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import pymumble_py3 as pymumble
|
import pymumble_py3 as pymumble
|
||||||
|
import pymumble_py3.constants
|
||||||
import variables as var
|
import variables as var
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
@ -123,6 +124,10 @@ class MumbleBot:
|
|||||||
self.mumble.set_codec_profile("audio")
|
self.mumble.set_codec_profile("audio")
|
||||||
self.mumble.start() # start the mumble thread
|
self.mumble.start() # start the mumble thread
|
||||||
self.mumble.is_ready() # wait for the connection
|
self.mumble.is_ready() # wait for the connection
|
||||||
|
|
||||||
|
if self.mumble.connected >= pymumble_py3.constants.PYMUMBLE_CONN_STATE_FAILED:
|
||||||
|
exit()
|
||||||
|
|
||||||
self.set_comment()
|
self.set_comment()
|
||||||
self.mumble.users.myself.unmute() # by sure the user is not muted
|
self.mumble.users.myself.unmute() # by sure the user is not muted
|
||||||
self.join_channel()
|
self.join_channel()
|
||||||
|
5
util.py
5
util.py
@ -345,7 +345,10 @@ class LoggerIOWrapper(io.TextIOWrapper):
|
|||||||
|
|
||||||
def write(self, text):
|
def write(self, text):
|
||||||
if isinstance(text, bytes):
|
if isinstance(text, bytes):
|
||||||
self.logger.log(self.logging_level, text.decode('utf-8').rstrip())
|
msg = text.decode('utf-8').rstrip()
|
||||||
|
self.logger.log(self.logging_level, msg)
|
||||||
|
super().write(msg + "\n")
|
||||||
else:
|
else:
|
||||||
self.logger.log(self.logging_level, text.rstrip())
|
self.logger.log(self.logging_level, text.rstrip())
|
||||||
|
super().write(text + "\n")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user