WhippingBot – Update

Well, I was less lazy than I originally thought I’d be and I added scripting support. It’s not done YET but I’m making progress. This is the userscript.py file (must be called that; directory can be changed via the bot’s settings file); it contains the bot command “HelloWorld” so if I typed “@HelloWorld” (@ being the bot prefix) it would return in a Private Message or in the channel “MY_NICK: Hello World; this was coded with Python scripting!”:

# Python Functions for Mr. Pig’s IRC Bot
# Python Scripting Interface (Actual
# Functions)
# ————————————–
# Code the function, have it return a
# value. Value returned will be sent to
# channel/user.
# ————————————–
# Functions prefixes:
# mpCmd_All_NAME() – Both Private Msg and Channel
# mpCmd_Priv_NAME() – Private Msg ONLY
# mpCmd_Chan_NAME() – Channel Msg ONLY
# ————————————–

# Import C++ to Python Interface and related functions
import MPIRC_INTERFACE
from MPIRC_INTERFACE import *

def mpCmd_All_HelloWorld(sData):

sCaller = MPIRC_INTERFACE.mpirc_getCallerNick(sData)
return sCaller + “: Hello World; this was coded with Python scripting!”

All you need to do to add a new function is add a new function define! Maybe I’ll get around to releasing it…

More info here.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>