Home > BugBot

BugBot

BugBot is a project mainly written in Python, it's free.

A MafiaBot which mutated to provide a basic level framework.

This bot is originally created to run Mafia games on freenode. I seperated each section into modules because some other people wanted a lightweight bot they could do whatever they wanted to do with. I've spent more time on the framework building it up for these people instead of the mafia part of the bot itself.


Run genconfig.py to set your configuration options. Run BugBot.py to load up your bot.


Use genplugin.py to get a blank plugin file. I don't have command name conflict resolving yet, so try not to use a command already in use.

The cmds class should contain all your commands as defines

There is regular expression support for snarfing strings directly out of the chat, these are contained in the regexp class. The format of this is simple:

def commandName(self,match):
    r'Regular Expression'
    doStuff()

match will contain the result from an re.group(0) function. Usually the matching string.

The only infrastructure I provide for you to use is outlined below. You will need to import any modules for anything else you need.

self._parent. term -> Prints to the console -> term(LEVEL,'TEXT') -> Use FUNC, SUB, DBG and ERROR for the LEVEL, 'TEXT' should be obvious.

send - Sends a message to IRC -> send('TEXT',nick=False,channel=False) -> 'TEXT' is what you want to send -> nick will be prepended to TEXT if given. You can use True to provide the callers nick -> Channel will default to the current channel unless you specify otherwise

quote - Sends a raw irc command -> quote('TEXT') -> 'TEXT' is your command

notice - sends an irc notice -> notice('TEXT','TARGET') -> 'TEXT' is the notice content -> 'TARGET' can be a person or a channel

getNick getHost getUser getFullHost getChannel -> All return what you'd expect

getMessage -> Returns everything after the command

getArg(argNum) ->getArg(num) -> num is any integer, it'll return the word at the position after the message, starting at one

    command arg1 arg2 arg3
        0    1    2    3