Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- class IRCReader:
- def send(self, text):
- print ">>" + text
- def quitMessage(self, x):
- msg = x[1][2].split(" ")
- if len(msg) >= 2:
- msg = " ".join(msg[1:])
- else:
- msg = "Death is but a sweet release from life!"
- self.send("QUIT :" + msg)
- return "Completed!"
- def setup(self):
- self.ntc = {
- "DIE": self.quitMessage
- }
- self.prv = {
- }
- self.cmd = {
- "PING": lambda x: "PONG",
- "NOTICE": lambda x: self.ntc.get(x[1][1], lambda x: "Nothing")(x),
- "PRIVMSG": lambda x: self.prv.get(x[1][1], lambda x: "Nopes")(x)
- }
- data = (("nick", "user", "host"), ("WAT", "DIE", "Oh hey there!"))
- temp = IRCReader()
- temp.setup()
- print temp.cmd.get(data[1][0], lambda x: "Zilch")(data)
Add Comment
Please, Sign In to add comment