Skip to content

Commit

Permalink
[admin] make hold_ground configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Alfassa committed Nov 10, 2012
1 parent 8591689 commit ef0ff5c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

import os

def configure(config):
"""
| [admin] | example | purpose |
| -------- | ------- | ------- |
| hold_ground | False | Auto re-join on kick |
"""
config.add_option('admin', 'hold_ground', "Auto re-join on kick")

def join(willie, trigger):
"""Join the specified channel. This is an admin-only command."""
# Can only be done in privmsg by an admin
Expand Down Expand Up @@ -80,19 +88,20 @@ def me(willie, trigger):
me.rule = (['me'], r'(#?\S+) (.*)')
me.priority = 'low'

def defend_ground(willie, trigger):
def hold_ground(willie, trigger):
"""
This function monitors all kicks across all channels willie is in. If he
detects that she is the one kicked she'll automatically join that channel.
This function monitors all kicks across all channels willie is in. If it
detects that it is the one kicked it'll automatically join that channel.
WARNING: This may not be needed and could cause problems if willie becomes
annoying. Please use this with caution.
"""
channel = trigger.sender
willie.write(['JOIN'], channel)
defend_ground.event = 'KICK'
defend_ground.rule = '.*'
defend_ground.priority = 'low'
if willie.config.admin.hold_ground:
channel = trigger.sender
willie.join(channel)
hold_ground.event = 'KICK'
hold_ground.rule = '.*'
hold_ground.priority = 'low'

def mode(willie, trigger):
"""Set a user mode on Willie. Can only be done in privmsg by an admin."""
Expand Down

0 comments on commit ef0ff5c

Please sign in to comment.