fix: pymumble callback function jammed the loop in pymumble, fixed #164

This commit is contained in:
Terry Geng 2020-05-29 14:52:54 +08:00
parent 58b7600cf9
commit a86a025d9a
No known key found for this signature in database
GPG Key ID: F982F8EA1DF720E7

View File

@ -141,8 +141,10 @@ class MumbleBot:
"Unknown action for when_nobody_in_channel" "Unknown action for when_nobody_in_channel"
if var.config.get("bot", "when_nobody_in_channel", fallback='') in ['pause', 'pause_resume', 'stop']: if var.config.get("bot", "when_nobody_in_channel", fallback='') in ['pause', 'pause_resume', 'stop']:
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_USERREMOVED, self.users_changed) user_change_callback = \
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_USERUPDATED, self.users_changed) lambda user, action: threading.Thread(target=self.users_changed, args=(user, action), daemon=True).start()
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_USERREMOVED, user_change_callback)
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_USERUPDATED, user_change_callback)
# Debug use # Debug use
self._loop_status = 'Idle' self._loop_status = 'Idle'