]> kaliko git repositories - sid.git/commitdiff
Fixed missing bot method
authorkaliko <kaliko@azylum.org>
Fri, 24 Mar 2023 15:05:21 +0000 (16:05 +0100)
committerkaliko <kaliko@azylum.org>
Fri, 24 Mar 2023 15:05:21 +0000 (16:05 +0100)
sid/sid.py

index 19ba57fdc2b2b38b2531fcdef62649b585e8656d..d74eaf89a7250d2b06e5ac7a3183e5913e0d1987 100644 (file)
@@ -176,6 +176,15 @@ class MUCBot(slixmpp.ClientXMPP):
                 log.debug('Registered command: %s', name)
                 self.commands[name] = value
 
+    def unregister_bot_plugin(self, plugin):
+        for name, value in inspect.getmembers(plugin):
+            if inspect.ismethod(value) and \
+               getattr(value, '_bot_command', False):
+                name = getattr(value, '_bot_command_name')
+                log.debug('Unegistered command: %s', name)
+                self.commands[name] = value
+        self.plugins.remove(plugin)
+
     def foreach_plugin(self, method, *args, **kwds):
         for plugin in self.plugins:
             log.debug('calling %s for %s', method, plugin)