5
""" do voice on join """
7
__copyright__ = 'this file is in the public domain'
9
from gozerbot.commands import cmnds
10
from gozerbot.callbacks import callbacks
11
from gozerbot.examples import examples
12
from gozerbot.plughelp import plughelp
14
plughelp.add('autovoice', 'enable auto voicing of people join .. commands \
15
work for the channels the commands are given in')
17
def preautovoice(bot, ievent):
18
""" precondition on auto-op .. we must be op """
19
if ievent.channel in bot.state['opchan']:
22
def cbautovoice(bot, ievent):
23
""" autovoice callback """
26
chandata = bot.channels[ievent.channel]['autovoice']
30
bot.voice(ievent.channel, ievent.nick)
32
callbacks.add('JOIN', cbautovoice, preautovoice)
34
def handle_autovoiceon(bot, ievent):
35
""" autovoice-on .. enable autovoice for channel the command was given \
37
bot.channels[ievent.channel]['autovoice'] = 1
38
ievent.reply('autovoice enabled on %s' % ievent.channel)
40
cmnds.add('autovoice-on', handle_autovoiceon, 'OPER')
41
examples.add('autovoice-on', 'enable autovoice on channel in which the \
42
command is given', 'autovoice-on')
44
def handle_autovoiceoff(bot, ievent):
45
""" autovoice-off .. disable autovoice for the channel the command was \
47
bot.channels[ievent.channel]['autovoice'] = 0
48
ievent.reply('autovoice disabled on %s' % ievent.channel)
50
cmnds.add('autovoice-off', handle_autovoiceoff, 'OPER')
51
examples.add('autovoice-off', 'disable autovoice on channel in which \
52
the command is given', 'autovoice-off')