I named the Lucky Charms python file "Lucky Charms.py" like it says in the Completed Code section of the tutorial.
Thanks, I fixed the tutorial.
I also added a note to make sure someone doesn't put a space in it like I did.
What's the difference between using class for event-handlers and using module-level handlers?
When using module-level handlers you must use one <event> element in the configuration XML for each handler. When using a class, you must call addHandler() for each handler in the class's __init__() Python function.
I am planning to have BUG auto-detect your handlers for both methods; I just need to figure out how to handle backward-compatibility so that BUG doesn't register each handler twice.
Is one better than the other?
I prefer module-level for a few reasons. First, it's less typing and easier to code since you don't need a class. Second, I like to see the events that a mod requires in the configuration XML rather than buried in the Python. If you're looking at the Python you can already read the function names to see which events it uses.
Third, and most important, it's easier for mods to work together if classes aren't involved. It's really not hard to use classes, but it's just easier to skip them in this case. You can have mod A call out to mod B to have it do something without needing to provide a function to get track and make the class's object available.
However, my preference is far from overwhelming. I would advise you to go with what you understand better.
Normally I would use a class when I needed to initialize data in a single __init__() function that couldn't be done when the module was first imported. However, I added <init> for just this purpose: a function that gets called once after BUG initializes itself. This gives you the same benefit as __init__() but at the module level.
And what is the differences (if any) to the config xml file?
Many <event>s (and maybe an <init>) versus a single <events>.