diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-09 03:07:51 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-09 03:08:53 +0100 |
commit | 950a06e6d743d96989870d640d56f149e4cb0bde (patch) | |
tree | f42c15696b2dd7882e783024b17139081a281d3a | |
parent | cfb074c17875e389b894cdc3447773a1ead928ca (diff) | |
download | poezio-950a06e6d743d96989870d640d56f149e4cb0bde.tar.gz poezio-950a06e6d743d96989870d640d56f149e4cb0bde.tar.bz2 poezio-950a06e6d743d96989870d640d56f149e4cb0bde.tar.xz poezio-950a06e6d743d96989870d640d56f149e4cb0bde.zip |
Added the super-useful and popular pacokick
-rw-r--r-- | plugins/pacokick.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/pacokick.py b/plugins/pacokick.py new file mode 100644 index 00000000..3ecef7a8 --- /dev/null +++ b/plugins/pacokick.py @@ -0,0 +1,20 @@ +from random import choice +from tabs import MucTab + +from plugin import BasePlugin + +class Plugin(BasePlugin): + def init(self): + self.add_command('pacokick', self.command_kick, '/pacokick <nick> [reason]\nPacokick: kick a random user.') + + def command_kick(self, arg): + tab = self.core.current_tab() + if isinstance(tab, MucTab): + kickable = list(filter(lambda x: x.affiliation in ('none', 'member'), tab.users)) + if kickable: + to_kick = choice(kickable) + if to_kick: + to_kick = to_kick.nick + tab.command_kick(to_kick + ' ' +arg) + else: + self.core.information('No one to kick :(', 'Info') |