Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tinychat
- import thread
- import time
- room = tinychat.TinychatRoom(raw_input("Enter room name: "), raw_input("Enter username: "), raw_input("Enter password: "))
- room.echo = True
- thread.start_new_thread(room.connect, ())
- while not room.connected: time.sleep(1)
- while room.connected:
- msg = raw_input()
- if len(msg) > 0:
- if msg[0] == "/":
- msg = msg[1:]
- if len(msg) > 0:
- parts = msg.split(" ")
- if len(parts) == 1:
- cmd = parts[0]
- pars = []
- par = ""
- else:
- cmd = parts[0]
- pars = parts[1:]
- par = " ".join(parts[1:])
- if cmd.lower() == "say":
- room.say(par)
- elif cmd.lower() == "pm":
- if len(pars) > 1:
- room.pm(" ".join(pars[1:]), pars[0])
- else:
- print("Please supply the recipient's nick as well as the message to send")
- elif cmd.lower() == "nick":
- room.setNick(par)
- elif cmd.lower() == "color":
- room.cycleColor()
- elif cmd.lower() == "ban":
- room.ban(par)
- else:
- room.say(msg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement