Last active
August 29, 2015 14:26
-
-
Save TJRoger/464f23bbed693de58419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var finished = true; | |
var onFriendsMessage = function onFriendsMessage(source, message, type, chatter){ | |
// respond to both chat room and private messages | |
if (type == 1) //1, message; 2, tying | |
if(friends.personaStates[source] != undefined){ | |
console.log('Received message: \'' +message+'\' from '+friends.personaStates[source].player_name); | |
if(finished){ | |
var rl = require('readline').createInterface({ | |
input: process.stdin, | |
ouput: process.stdout | |
}); | |
finished = false; | |
rl.question("What do you want to say to "+friends.personaStates[source].player_name ,function(answer){ | |
//console.log(answer); | |
friends.sendMessage(source, answer, steam.EChatEntryType.ChatMsg); | |
finished = true; | |
rl.close(); | |
}); | |
} | |
} | |
else | |
console.log('Received message: ' +message); | |
//console.log(util.inspect(steam.EChatEntryType, false, null)); | |
if (message == 'ping') { | |
friends.sendMessage(source, 'pong', steam.EChatEntryType.ChatMsg); // ChatMsg by default | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes, a conversion is triggered only after an initiation.