Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import chatango
- #Went over the following already...
- address = input('CHTRM: ')
- username = input('USER:')
- password = input('PASS:')
- room = chatango.chatroom(address)
- #Just do this. It's cleaner.
- chatango.debug(False)
- #duh.
- room.login(username, password)
- #FUNSTUF! Main command loop:
- while True:
- event = room.get_event() #get an event
- if event["event"] == "message": #Determine that it's a message
- post = event["message"] #get the whole message, put it into something more readable
- message = post.content #take the text out
- poster = post.user #take the poster
- prettyPoster = poster.displayname #get the proper capitalization of it
- messageArray=message.split(' ') #split up the message
- print(prettyPoster+': '+message) #post it in the script's window, cuz u can.
- if messageArray[0].lower()=='!say': #Determine the message starts with a command, eg: "!say"
- room.say(' '.join(messageArray[0])) #post the following text to chat
- continue
- elif event["event"] == "login": #I don't feel like getting into this. figgur it out ursalf.
- poster = event["user"]
- prettyPoster = poster.displayname
- print(prettyPoster + " just logged onto chat.")
- continue
- elif event["event"] == "logout":
- poster = event["user"]
- prettyPoster = poster.displayname
- print(prettyPoster + " just logged off chat.")
- room.disconnect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement