mirror of
https://github.com/azlux/botamusique
synced 2024-11-23 13:56:17 +00:00
Compare commits
2 Commits
3200c83fd0
...
6faadd6669
Author | SHA1 | Date | |
---|---|---|---|
|
6faadd6669 | ||
|
efab8928f5 |
@ -84,7 +84,10 @@ port = 64738
|
||||
#pip3_path = venv/bin/pip
|
||||
|
||||
# 'logfile': write logs into this file.
|
||||
# 'redirect_strerr': capture outputs from stderr and write into the `logfile`,
|
||||
# useful for capture the exception message when the bot crash.
|
||||
#logfile =
|
||||
#redirect_strerr = False
|
||||
|
||||
#announce_current_music = True
|
||||
#allow_other_channel_message = False
|
||||
|
10
mumbleBot.py
10
mumbleBot.py
@ -246,6 +246,11 @@ class MumbleBot:
|
||||
def message_received(self, text):
|
||||
raw_message = text.message.strip()
|
||||
message = re.sub(r'<.*?>', '', raw_message)
|
||||
if text.actor == 0:
|
||||
# Some server will send a welcome message to the bot once connected.
|
||||
# It doesn't have a valid "actor". Simply ignore it here.
|
||||
return
|
||||
|
||||
user = self.mumble.users[text.actor]['name']
|
||||
|
||||
if var.config.getboolean('commands', 'split_username_at_space'):
|
||||
@ -797,8 +802,9 @@ if __name__ == '__main__':
|
||||
if logfile:
|
||||
print(f"Redirecting stdout and stderr to log file: {logfile}")
|
||||
handler = logging.handlers.RotatingFileHandler(logfile, mode='a', maxBytes=10240) # Rotate after 10KB
|
||||
sys.stdout = util.LoggerIOWrapper(bot_logger, logging.INFO, fallback_io_buffer=sys.stdout.buffer)
|
||||
sys.stderr = util.LoggerIOWrapper(bot_logger, logging.INFO, fallback_io_buffer=sys.stderr.buffer)
|
||||
if var.config.getboolean("bot", "redirect_stderr", fallback=False):
|
||||
sys.stderr = util.LoggerIOWrapper(bot_logger, logging.INFO,
|
||||
fallback_io_buffer=sys.stderr.buffer)
|
||||
else:
|
||||
handler = logging.StreamHandler()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user