Problems I’ve faced & how I fixed them:
What’s in msg and args? I see them in the method signature, but where do they come from?
msg seems to be a parsed form of the raw message that the bot gets. I used pprint(msg) to get this:
IrcMsg(prefix="[email protected]", command="PRIVMSG", args=('#b3ta', '@rroulette spin'))
So prefix is the hostmask of the user who called a function. command is virtually useless, because just about all interaction with the bot (especially user to bot) is done with a PRIVMSG. args in msg is the more interesting thing – args is the channel, args appears to be the actual line of text that was entered.
As for args, the one that’s passed to your function, I presume it has something to do with how you wrap your function. Unfortunately, I haven’t found a list online of options wrap will take, and I haven’t perused the code enough to find what it uses.
So can I use pprint with ‘irc’ then?
Nope. Trying just gets you something like
<supybot.callbacks.NestedCommandsIrcProxy object at 0x03B5E190>. irc seems to be the object that stored everything about the bot.
There’s something about “no Class found”…
Yeah… you need something along the lines of Class = Aurora in plugin.py. Why? Because in __init__.py, you have Class = plugin.Class . You might be able to change __init__.py to read something like Class = plugin.Aurora, but I doubt it’ll work.
Anything about wrapping your function?
Well, the syntax seems to be function_name = wrap(function_name, listOfSomeSort). Looking at the function definition (commands.py, towards the bottom), this matches, though it also seems to say that you can change the name if you specify a string as a third argument.
The strange thing is the list. It seems to be double duty as to restricting who can access it (first argument looks to always be public/private/op/admin/owner), and later arguments seem to be constraints on who can use the command, and/or are arguments passed to the functions. For example, (‘haveOp’, ‘change the x’) appears to ensure that the bot has op status in the channel, while many(‘something’) seems to indicate that a list will be passed to the function with whatever the user enters.
It’s all a bit confusing, I have yet to get my head around it completely.