I think I am using the latest version since I just installed the module
const SteamUser = require('steam-user');
const config = require('./config.json');
const client = new SteamUser();
const logOnOptions = {
accountName: config.username,
password: config.password
};
client.logOn(logOnOptions);
client.on('loggedOn', () => {
//mensaje cuando se logra iniciar sesion
console.log('Entraste a Steam :)');
console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID() + " /// ");
//ponerse el estado En Linea
client.setPersona(SteamUser.EPersonaState.Online);
//ponerse un juego por ID de juego
client.gamesPlayed(753);
//cambiarse nombre
//client.setPersona(SteamUser.EPersonaState.Online, 'Nuevo nombre')
// "̷̢̧̐͂̾ͤͭƝ҉o҉i҉s҉e"
//client.gamesPlayed(["Custom Game", "̷̢̧̐͂̾ͤͭƝ҉o҉i҉s҉e"]);
//client.gamesPlayed(["Custom Game", "Mentira si es de stim"]);
/* ________________________________________________________________________________
setTimeout(function(){
if (flag == true)
{
flag = false;
client.gamesPlayed(753);
console.log("Cambio a STEAM, flag now is false");
}else
{
flag = true;
client.gamesPlayed(["Custom Game", "̷̢̧̐͂̾ͤͭƝ҉o҉i҉s҉e"]);
console.log("Cambio a Noise, flag now is true");
}
},10000);
______________________________________________________________________________________
*/
//Practicamente esto es un TIMER como en c# solo que este ya tiene el Enable = true;
/* ______________________________________________________________________________________
var cambiarestado = function(){
if (flag == true)
{
flag = false;
client.gamesPlayed(753);
console.log("Cambio a STEAM, flag now is false");
}else
{
flag = true;
client.gamesPlayed(["Custom Game", "̷̢̧̐͂̾ͤͭƝ҉o҉i҉s҉e"]);
console.log("Cambio a Noise, flag now is true");
}
setTimeout(cambiarestado, 10000);
}
cambiarestado();
______________________________________________________________________________________
*/
});
//cuenta los items nuevos in mi inventario
client.on('newItems', function(count){
console.log(count +" nuevos items in tu inventario");
});
client.on('wallet', function(hasWallet, currency, balance){
console.log("Tu balance en la cartera es "+SteamUser.formatCurrency(balance, currency));
});
client.on("friendMessage", function(steamID, message) {
client.getPersonas([steamID], function(personas) {
var persona = personas[steamID.getSteamID64()];
var name = persona ? persona.player_name : ("[" + steamID.getSteamID64() + "]");
// the player's name is now available as name
});
if (message == "!play steam") {
client.chatMessage(steamID,"jugando STEAM ");
client.gamesPlayed(753);
}
else
if (message == "!play gtav") {
client.chatMessage(steamID,"jugando GTA V ");
client.gamesPlayed(271590);
}
else
if (message == "!play l4d2") {
client.chatMessage(steamID,"jugando Left 4 Dead 2");
client.gamesPlayed(550);
}else
if (message == "!play online") {
client.chatMessage(steamID,"Online");
client.gamesPlayed(0);
}else
if (message == "!info") {
client.chatMessage(steamID, "https://steamcommunity.com/profiles/"+steamID+"/ Hola , Soy el asistente de ̷̷̢̧̢̧̐͂̾ͤͭ̐͂̾ͤͭƝ҉o҉i҉s҉e, ahora mismo no se encuentra disponible, seguramente se está haciendo una eterna ;D ó mirando sus monas chinas.");
client.chatMessage(steamID,"/sticker Excited");
client.chatMessage(steamID, "Regresa pronto o deja tu mensaje para que pueda leerlo cuando esté disponible, Escucha ésto: https://www.youtube.com/watch?v=LACbVhgtx9I");
}else
if (message == "!eliminar"){
client.chatMessage(steamID, "Bye :demoticon:");
client.removeFriend(steamID);
}else
{
/*steamUser.getPersonas(["76561198155468977"], function (data) { console.log(data) });*/
client.chatMessage(steamID,"https://steamcommunity.com/profiles/"+steamID+"/");
client.chatMessage(steamID,/*,message+*/"\n\n[Mensaje automatico] :demoticon: Hola, De momento no me encuentro disponible :demoticon: \n\n");
client.chatMessage(steamID,"Procura no hacer spam ya que podrias ser eliminado sin piedad por el bot ");
}
});
client.on('friendRelationship', (steamID, relationship) => {
if (relationship == 2)
{
client.addFriend(steamID);
client.chatMessage(steamID, "https://steamcommunity.com/profiles/"+steamID+"/ [Mensaje Automatico] Ahora mismo ̷̷̢̧̢̧̐͂̾ͤͭ̐͂̾ͤͭƝ҉o҉i҉s҉e no se encuentra disponible, No escribas ->> !eliminar :demoticon:");
}
});
the error arises when I try to convert "personas to an array" ---> var persona = personas[steamID.getSteamID64()];