Skip to content

Instantly share code, notes, and snippets.

@TJRoger
Last active August 29, 2015 14:26
Show Gist options
  • Save TJRoger/464f23bbed693de58419 to your computer and use it in GitHub Desktop.
Save TJRoger/464f23bbed693de58419 to your computer and use it in GitHub Desktop.
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
}
}
@TJRoger
Copy link
Author

TJRoger commented Aug 6, 2015

Sometimes, a conversion is triggered only after an initiation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment