Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

[ Create a new account ]

Angron (127881)

Angron
  (email not shown publicly)

CS/HCI student at CMU [cmu.edu]. Plays Magic [magicthegathering.com], and reads StarCityGames [starcitygames.com], MTGNews [mtgnews.com], MTGSalvation [mtgsalvation.com], TheManaDrain [themanadrain.com] and Ars Technica [arstechnica.com]. Likes Gmail [gmail.com]

Journal of Angron (127881)

artsend.py

[ #82613 ]
Friday September 03 2004, @03:58PM
User Journal
#!/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()