Esempio n. 1
0
def init():
    global state
    state = PlugState()
    state.define('urls', {})
    return 1
Esempio n. 2
0
""" run garbage collector """

__copyright__ = 'this file is in the public domain'

from gozerbot.periodical import periodical
from gozerbot.generic import rlog
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.persist.persiststate import PlugState
from gozerbot.plughelp import plughelp
import gc, time

plughelp.add('gcollect', 'help the garbage collector')

state = PlugState()
state.define('wait', 300)
state.define('enable', 0)

if state['enable']:
    gc.enable()
    rlog(10, 'gcollect', 'garbage collector enabled .. wait is %s' % state['wait'])

def shutdown():
    periodical.kill()

def gcollect():
    rlog(1, 'gcollect', 'running collector')
    gc.collect()
    time.sleep(5)
    gc.collect()
Esempio n. 3
0
#

""" relay log messages to nicks joined on the partyline (DCC CHAT) """

from gozerbot.callbacks import callbacks
from gozerbot.persist.persiststate import PlugState
from gozerbot.commands import cmnds
from gozerbot.users import users
from gozerbot.examples import examples
from gozerbot.partyline import partyline
from gozerbot.plughelp import plughelp
import gozerbot.generic

plughelp.add('powernick', 'plugin used to monitor log messages')

state = PlugState()
state.define('nicks', {}) # username is key


def logcallback(level, description, txt):
    global state
    for nick in state['nicks'].values():
        partyline.say_nick(nick, "[%s] %s" % (description, txt)) 

def init():
    if not logcallback in gozerbot.utils.log.logcallbacks:
        gozerbot.utils.log.logcallbacks.append(logcallback)

def shutdown():
    if logcallback in gozerbot.utils.log.logcallbacks:
        gozerbot.utils.log.logcallbacks.remove(logcallback)
Esempio n. 4
0
    'anon',
]

from gozerbot.persist.persiststate import PlugState
from gozerbot.persist.persistconfig import PersistConfig
from gozerbot.callbacks import callbacks
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.users import users
from gozerbot.generic import getwho, rlog
import time

plughelp.add('throttle', 'throttle user commands per minute')

state = PlugState()
state.define('lasttime', {})
state.define('level', {})
state.define('cpm', {})  # commands per minute

cfg = PersistConfig()
cfg.define('enable', 1)


def throttlepre(bot, ievent):
    if cfg.get('enable'):
        return 1


def throttlecb(bot, ievent):
    try:
Esempio n. 5
0
def init():
    global state
    state = PlugState()
    state.define('urls', {})
    return 1
Esempio n. 6
0
#
#
""" relay log messages to nicks joined on the partyline (DCC CHAT) """

from gozerbot.callbacks import callbacks
from gozerbot.persist.persiststate import PlugState
from gozerbot.commands import cmnds
from gozerbot.users import users
from gozerbot.examples import examples
from gozerbot.partyline import partyline
from gozerbot.plughelp import plughelp
import gozerbot.generic

plughelp.add('powernick', 'plugin used to monitor log messages')

state = PlugState()
state.define('nicks', {})  # username is key


def logcallback(level, description, txt):
    global state
    for nick in state['nicks'].values():
        partyline.say_nick(nick, "[%s] %s" % (description, txt))


def init():
    if not logcallback in gozerbot.utils.log.logcallbacks:
        gozerbot.utils.log.logcallbacks.append(logcallback)


def shutdown():
Esempio n. 7
0
__depending__ = ['anon', ]

from gozerbot.persist.persiststate import PlugState
from gozerbot.persist.persistconfig import PersistConfig
from gozerbot.callbacks import callbacks
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.users import users
from gozerbot.generic import getwho, rlog
import time

plughelp.add('throttle', 'throttle user commands per minute')

state = PlugState()
state.define('lasttime', {})
state.define('level', {})
state.define('cpm', {}) # commands per minute

cfg = PersistConfig()
cfg.define('enable', 1)

def throttlepre(bot, ievent):
    if cfg.get('enable'):
        return 1

def throttlecb(bot, ievent):
    try:
        cpm = state['cpm']
        uh = ievent.userhost
Esempio n. 8
0
#
""" run garbage collector """

__copyright__ = 'this file is in the public domain'

from gozerbot.periodical import periodical
from gozerbot.generic import rlog
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.persist.persiststate import PlugState
from gozerbot.plughelp import plughelp
import gc, time

plughelp.add('gcollect', 'help the garbage collector')

state = PlugState()
state.define('wait', 300)
state.define('enable', 0)

if state['enable']:
    gc.enable()
    rlog(10, 'gcollect',
         'garbage collector enabled .. wait is %s' % state['wait'])


def shutdown():
    periodical.kill()


def gcollect():
    rlog(1, 'gcollect', 'running collector')