Module registration

# Module loading file
# Add the lines with YOURMODULE, your module should also be present
# in the module loader path (best is in './modules')
#
# Skeleton:
# __import__("YOURMODULE", globals(), locals(), [])
# mod_list = ["mantis", "YOURMODULE"]
import sys
sys.path.append('./modules')
 
__import__("mantis", globals(), locals(), [])
__import__("roulette", globals(), locals(), [])
 
 
mod_list = ["mantis", "roulette"]

Module itself

Skeleton:

import os, sys
 
__info__ = {    'author': 'kang',
                'email': 'kang@insecure.ws',
                'version': '1',
                'date': '07-11-2005' }
 
chan_handlers = []
msg_handlers = []
 
def init():
 
def chanmsg_handler(channel, nick, cmd, args):
 
def privmsg_handler(channel, nick, msg):
 
def die():

Module Sample:

import os, sys
import random
__info__ = {    'author': 'kang',
                'email': 'kang@insecure.ws',
                'version': '1',
                'date': '07-11-2005' }
 
chan_handlers = ['!roulette']
msg_handlers = []
 
gun_max_load = 6
gun_bullet_slot = random.randint(1, gun_max_load)
gun_current_slot = 0
 
 
def init():
        gun_max_load = 6
        gun_bullet_slot = random.randint(1, gun_max_load)
        gun_current_slot = 0
 
def chanmsg_handler(channel, nick, cmd, args):
        r = sys.modules['roulette']
        r.gun_current_slot = r.gun_current_slot + 1
        if r.gun_current_slot == r.gun_bullet_slot:
                action = 'PRIVMSG %s :*BANG*. %s is lying on the floor.\r\n' % (channel, nick)
                r.gun_bullet_slot = random.randint(1, r.gun_max_load)
                r.gun_current_slot = 0
        else:
                action = 'PRIVMSG %s :*clic*\r\n' % (channel)
        return action