Skip to content

Commit 950a06e

Browse files
committed
Added the super-useful and popular pacokick
1 parent cfb074c commit 950a06e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plugins/pacokick.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from random import choice
2+
from tabs import MucTab
3+
4+
from plugin import BasePlugin
5+
6+
class Plugin(BasePlugin):
7+
def init(self):
8+
self.add_command('pacokick', self.command_kick, '/pacokick <nick> [reason]\nPacokick: kick a random user.')
9+
10+
def command_kick(self, arg):
11+
tab = self.core.current_tab()
12+
if isinstance(tab, MucTab):
13+
kickable = list(filter(lambda x: x.affiliation in ('none', 'member'), tab.users))
14+
if kickable:
15+
to_kick = choice(kickable)
16+
if to_kick:
17+
to_kick = to_kick.nick
18+
tab.command_kick(to_kick + ' ' +arg)
19+
else:
20+
self.core.information('No one to kick :(', 'Info')

0 commit comments

Comments
 (0)