Пример #1
0
from gozerbot.tests import tests
import time, os

plughelp.add('away', "keep notice of who's away")

lasttime = []

# use datadir/away as pickle file
awaydict = PlugPersist('away.data')

# see if data attribute is set otherwise init it
if not awaydict.data:
    awaydict.data = {}
if not awaydict.data.has_key('enable'):
    awaydict.data['enable'] = 0
    awaydict.save()

def init():
    """ init plugin """
    if not awaydict.data['enable']:
        rlog(0, 'away', 'away is disabled')
        return 1
    else:
        rlog(0, 'away', 'away is enabled')
    callbacks.add('PRIVMSG', doaway, awaytest)
    callbacks.add('PRIVMSG', doback, backtest)
    return 1

def awaytest(bot, ievent):
    """ test if away callback should be called """
    if (len(ievent.txt) > 1 and ievent.txt[-1] == '\001' and \