From 3f25c84888c1da96e6baa19c9d2a6d7297b3b424 Mon Sep 17 00:00:00 2001 From: Thorsten S Date: Wed, 12 May 2021 19:12:49 +0200 Subject: [PATCH] mute functionality --- distbot/bot/bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/distbot/bot/bot.py b/distbot/bot/bot.py index 009a397..36b2a3d 100644 --- a/distbot/bot/bot.py +++ b/distbot/bot/bot.py @@ -36,6 +36,7 @@ class Bot(slixmpp.ClientXMPP): self.add_event_handler('muc::%s::got_online' % room, self.muc_online) self._initialize_plugins() + self.muted = False def _initialize_plugins(self): self.register_plugin('xep_0045') @@ -127,6 +128,11 @@ class Bot(slixmpp.ClientXMPP): if msg['type'] in ('normal', 'chat', 'groupchat'): message = msg['body'] + if message == f"{self.nick}: mute": + self.muted = True + elif message == f"{self.nick}: unmute": + self.muted = False + if "hangup" in message: self.disconnect() @@ -137,6 +143,10 @@ class Bot(slixmpp.ClientXMPP): self.initialize_actionworker() self.echo("Worker One available for master.") + # TODO: still record stuff and react on things? + if self.muted: + return + nick_offset, routing_key = self.get_amqp_routing_key(self.nick, msg) if msg["type"] == "groupchat": -- 2.39.2