PDA

View Full Version : Request for modules!


jemfinch
08-17-2002, 04:35 AM
Ok, so my bot (http://www.sf.net/projects/supybot/) has stabilized, and I'm looking for a few new modules for it, but don't have a whole lot of time to code them myself. So I figure I'll post my requests here, and if anyone wants to pick them up, they can post their code/ask questions about using the bot/get help developing here.


I need a "seen" plugin -- something that keeps track of when a user was last seen. Properly, this might need to integrate with the user database, but it should also work nearly as well with nicks (and using just nicks would make it easy to write it as a plugin and not have to modify any bot code.)

I need a "news" plugin, something to give people news when they join a channel. It should only give a user news once, and if there are too many news items, it should just tell them how to get them all (without actually giving it to them.) People adding new news items should be able to specify the "expiration date" of the news items.

I need a "notes" plugin, where users can leave notes for other users that aren't currently online. Even better, users should be able to specify that they don't accept notes, that they do accept them, but only from certain individuals, or that they except them from all except certain individuals.

I really would love a plugin that worked with Debian's package files in some way similar to what "apt" does on OPN's #debian.

I need various network-related plugins, but unless you're experienced with either threaded coding or asynchronous networking with asyncore, those will probably have to wait.

Anything else you can think of to implement is fair game, if it's written according to docs/STYLE and it's not too buggy, I'll be happy to throw it in.

Anyway, just figured I'd post this request :) Thanks a bunch to all who help!

Jeremy

kmj
08-17-2002, 06:54 PM
I swear I haven't used my home computer for more than 10 minutes total, since the beginning of june. (right now I'm on my mom's computer (*gag* XP) ). I promise once I get supybot up on my home computer, I'll implement one (or a few) modules for it. May be a few weeks, though.. still got this lovely summer weather. :)

jemfinch
08-18-2002, 03:20 AM
Originally posted by kmj
(right now I'm on my mom's computer (*gag* XP) ).


SupyBot is entirely developed with XP and Cygwin, you know :)


I promise once I get supybot up on my home computer, I'll implement one (or a few) modules for it. May be a few weeks, though.. still got this lovely summer weather. :)

Absolutely...this last part of summer is definitely the best part :) The breeze is what really puts it over the edge :)

Jeremy

jemfinch
08-20-2002, 02:04 AM
Ooh, another plugin I'd like is statistics: like how many smileys, how many words/characters/messages etc. a user has sent to a channel. Stats should be channel-specific (and thus stored in their own per-channel files in the data/ directory).

If you want an example of it already implemented in another bot I've written, go to #linux on irc.arstechnica.com and ask }8-] for "stats jemfinch".

Jeremy

jemfinch
08-21-2002, 06:07 PM
Yup, thought of another one :)

I'd like a version of FactoidsCommands that replicated InfoBot's capabilities, which means it'd have to inherit from callbacks.PrivmsgRegexp instead of callbacks.Privmsg (since InfoBot uses regular expressions to recognize questions and new factoids).

Jeremy

jemfinch
08-21-2002, 07:02 PM
0.37.0 is up! If you haven't updated, you'll want this new version before digging in (even though I don't think any major interfaces changed).

Jeremy

inkedmn
08-21-2002, 09:01 PM
/me dl's :)

inkedmn
08-21-2002, 10:01 PM
ok, having some problems...

after doing the conf stuff, i get this when trying to run it :

D:\supybot.37\supybot\src>python bot.py
Traceback (most recent call last):
File "bot.py", line 44, in ?
import conf
File "conf.py", line 256, in ?
import debug # Yes, it's a circular import. So kill me.
File "debug.py", line 44, in ?
_errfd = open(conf.errorfile, 'a')
IOError: [Errno 2] No such file or directory: 'logs\\error'


i'm able to bypass this error by creating a 'logs' dir in the src directory. once i do that, i get this error:


D:\supybot.37\supybot\src>python bot.py
'UsersDictionary', ('conf\\users',), {}
'ChannelEnforcer', (), {'revenge': 1}
Traceback (most recent call last):
File "bot.py", line 118, in ?
main()
File "bot.py", line 100, in main
conf.makeClass(className, (name, makeIrc(nick, ircConf))+args, kwargs)
File "bot.py", line 96, in makeIrc
irc.addCallback(conf.makeClass(*tup))
File "conf.py", line 268, in makeClass
debug.recoverableException()
File "debug.py", line 103, in recoverableException
text = cgitb.text((E, e, tb))
AttributeError: 'module' object has no attribute 'text'


if i redefine "text" as a generic string, i can bypass this error. but, i get this next one when i start the bot:


D:\supybot.37\supybot\src>python bot.py
'UsersDictionary', ('conf\\users',), {}
error'ChannelsDictionary', ('conf\\channels',), {}

error'ChannelEnforcer', (), {'revenge': 1}
errorTraceback (most recent call last):
File "bot.py", line 118, in ?
main()
File "bot.py", line 100, in main
conf.makeClass(className, (name, makeIrc(nick, ircConf))+args, kwargs)
File "bot.py", line 96, in makeIrc
irc.addCallback(conf.makeClass(*tup))
File "irclib.py", line 247, in addCallback
for command in callback.commands():
AttributeError: 'NoneType' object has no attribute 'commands'


haven't tried to get past this one...

anyway, thought you'd like to know :)

jemfinch
08-21-2002, 10:43 PM
You can't run the bot from the src directory. Run it like this:

src/bot.py

or

src/bot.py -c myconf.py

If you want to specify a specific configuration file.

That's the source of all your problems. You can remove src/logs now.

Jeremy

inkedmn
08-22-2002, 02:10 AM
still getting that last error (the one about NoneType having no commands attribute):


D:\supybot.37\supybot>python src\bot.py
'FunCommands', (), {}
errorTraceback (most recent call last):
File "src\bot.py", line 118, in ?
main()
File "src\bot.py", line 100, in main
conf.makeClass(className, (name, makeIrc(nick, ircConf))+args, kwargs)
File "src\bot.py", line 96, in makeIrc
irc.addCallback(conf.makeClass(*tup))
File "src\irclib.py", line 247, in addCallback
for command in callback.commands():
AttributeError: 'NoneType' object has no attribute 'commands'

jemfinch
08-22-2002, 03:31 PM
That's interesting, I don't know what that could be from. Is there perhaps a bigger traceback you could send?

Jeremy

inkedmn
08-22-2002, 06:09 PM
no, that's the whole traceback...

inkedmn
08-22-2002, 10:03 PM
ok, i changed up Irc.addCallback to give me a bit of a better idea what was happening, here's the code :


def addCallback(self, callback):
self.callbacks.append(callback)
print "hello"
for command in callback.commands():
if command in self.commands:
self.commands[command].append(callback)
else:
self.commands[command] = [callback]
print "hello again"


now, when i run the bot, i get the following output:


D:\supybot.37\supybot>python src/bot.py
hello
hello again
hello again
hello again
hello again
hello again
hello
hello again
hello again
hello again
hello
hello again
hello
hello again
hello
hello again
hello
hello again
hello
hello again
hello
hello again
hello
hello again
'FunCommands', (), {}
errorhello
Traceback (most recent call last):
File "src/bot.py", line 118, in ?
main()
File "src/bot.py", line 100, in main
conf.makeClass(className, (name, makeIrc(nick, ircConf))+args, kwargs)
File "src/bot.py", line 96, in makeIrc
irc.addCallback(conf.makeClass(*tup))
File "src\irclib.py", line 248, in addCallback
for command in callback.commands():
AttributeError: 'NoneType' object has no attribute 'commands'


i also tried this, adding a print statement with the name of the actual command that it's trying to append, like this:


def addCallback(self, callback):
self.callbacks.append(callback)
for command in callback.commands():
print str(command)
if command in self.commands:
self.commands[command].append(callback)
else:
self.commands[command] = [callback]


this time, i got this output:


D:\supybot.37\supybot>python src/bot.py
332
JOIN
KICK
MODE
TOPIC
376
377
KICK
PRIVMSG
PRIVMSG
PRIVMSG
PRIVMSG
PRIVMSG
PRIVMSG
PRIVMSG
'FunCommands', (), {}
errorTraceback (most recent call last):
File "src/bot.py", line 118, in ?
main()
File "src/bot.py", line 100, in main
conf.makeClass(className, (name, makeIrc(nick, ircConf))+args, kwargs)
File "src/bot.py", line 96, in makeIrc
irc.addCallback(conf.makeClass(*tup))
File "src\irclib.py", line 247, in addCallback
for command in callback.commands():
AttributeError: 'NoneType' object has no attribute 'commands'


well, hope this helps out some.

best of luck, compadre :)

jemfinch
08-22-2002, 10:49 PM
This sounds like a configuration problem -- first, make a tarball of your whole folder and put that somewhere so I can download it and do some testing myself. Then, move your supybot directory somewhere else, roll out the new tarball again, and then try running it.

Maybe some old files are hurting things.

Jeremy

inkedmn
08-22-2002, 11:14 PM
ok, i'll let you know where it is...


[edit]

i deleted every other supybot file on my machine, tried running it, and got more errors...

just FYI, let me know if you want them.

jemfinch
08-23-2002, 12:56 AM
Of course I want them! :)

Jeremy

jemfinch
08-23-2002, 09:40 AM
Mmm...many breakthroughs on this allnighter I just pulled (which was stupid, but oh well...)

I have threaded callbacks written -- now you can get the nice, easy threaded behavior simply by putting "threaded = True" at the class level in your subclass of callbacks.Privmsg or callbacks.PrivmsgRegexp.

And to exercise this functionality, I wrote a freshmeat command that goes to freshmeat and gets information about a project there. But even cooler, I wrote this to test callbacks.PrivmsgRegexp in threaded form:


<jemfinch> http://coderforums.net/showthread.php?s=&threadid=877
<supybot> CoderForums > Activities > Competitions > New Comp Idea
<jemfinch> http://coderforums.net/showthread.php?s=&threadid=329
<supybot> CoderForums > Activities > Competitions > Competition Forum Specific Rules (READ BEFORE POSTING!)
<jemfinch> http://coderforums.net/showthread.php?s=&threadid=886&pagenumber=2
<supybot> CoderForums > Programming > Python > Request for modules!
<jemfinch> blah blah blah <http://coderforums.net/showthread.php?s=&threadid=886&pagenumber=2>
<supybot> CoderForums > Programming > Python > Request for modules!


So he sniffs conversation on a channel and when he sees a CoderForums link, he downloads the page and sends the forum/title to the channel. Now Dru Lee Parsec won't have to download threads only to realize they're in the Python forum, and I won't have to download all those ugly VB and Javascript threads...

Anyway, just wanted to make a minor little announcement :)

Jeremy

inkedmn
08-23-2002, 02:39 PM
nice :)