Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
User Journal

Journal Angron's Journal: artsend.py

#!/usr/bin/python

from twisted.protocols import toc
from twisted.internet import reactor
from twisted.internet import base
import twisted.im.tocsupport as ts

screenname = 'SCGArticleBot'
password = 'magical'

class articleBot(toc.TOCClient):
    """AIM article transmission bot"""

    def gotConfig(self, mode, buddylist, permit, deny):
        global screenname

        # add someone to our blocked list?
        self.add_deny([])

        # add self to buddy list
        self.add_buddy([screenname])

    def updateBuddy(self, username, online, evilness, signontime, idletime, userclass, away):
        """called when a buddy changes state"""
        print "status changed for",username

    def hearWarning(self, warnlvl, screenname):
        """called when someone warns us"""
        print screenname, "warned us"

    def hearError(self, errcode, *args):
        """called when server sends error"""
        print "received error:", errcode

    def hearMessage(self, username, message, autoreply):
        """called when a message is received"""

        #remove the incoming message's html
        msg = ts.dehtml(message)
        print "got message:",msg
        reply = ts.html("echo: %s" % msg)

        self.say(username, reply)

    def onLine(self):
        """called when we first sign online"""
        print "Signed online"

bot = base.BCFactory(aimBot(screenname, password))
reactor.connectTCP("toc.oscar.aol.com", 9898, bot)

reactor.run()

It's a naive, domestic operating system without any breeding, but I think you'll be amused by its presumption.

Working...