Lyend

example.py

Nov 23rd, 2012
1,906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. import ch
  2. class TestBot(ch.RoomManager):
  3.   def onConnect(self, room):
  4.     print("Connected")
  5.    
  6.   def onReconnect(self, room):
  7.     print("Reconnected")
  8.    
  9.   def onDisconnect(self, room):
  10.     print("Disconnected")
  11.  
  12.   def onMessage(self, room, user, message):
  13.     print(user.name+":"+message.body)
  14.     if message.body.startswith("!a"): # Ugh, I should write something proper. Don't do this, folks!
  15.       room.message("AAAAAAAAAAAAAAAAAAA!,")
  16.  
  17.  
  18.   def onFloodWarning(self, room):
  19.     room.reconnect()
  20.  
  21.   def onPMMessage(self, pm, user, body):
  22.     pm.message(user, body) # echo
  23.  
  24. if __name__ == "__main__":
  25.   TestBot.easy_start()
Advertisement
Add Comment
Please, Sign In to add comment