-
Posts
73 -
Joined
-
Last visited
Community Answers
-
Vanilla's post in Answer by level was marked as the answer
client.on("friendMessage", (steamid, message) => {
if (message === "test") {
client.getSteamLevels([steamid], function(results) {
if (results[steamid] > 5) {
client.chatMessage(steamid, "u have +5 lvl.");
console.log("done");
}
});
}
});
-
Vanilla's post in Chat Anti Spam Help was marked as the answer
Not really an answer, but here's a small code I use on my bot to prevent chat spam.
It will block a person who send same messages every 2 second.
var antispam; var markedSteamID; function spamtimer() { //when called, it will reset antispam = 0; markedSteamID = 0; } setInterval(spamtimer, 2000); //call spamtimer function every 2 sec //.. your code here client.on("friendMessage", function(senderID, message) { //anti spam if (senderID == admin){ //Ignore if chat from admin } else if ((antispam == message) && (markedSteamID == senderID.getSteamID64())) { client.chatMessage(senderID, "I caught you spamming"); //do something, like block that person or something } //.. your code here.. to respond chat antispam = message; //bot will record the message, will reset every 2 sec markedSteamID = senderID.getSteamID64(); //bot will record SteamID of sender, will reset every 2 sec }); -
Vanilla's post in Error: "Not Logged In" was marked as the answer
Well, I didn't use "pollFailure" on my bot, and I use this solution for my bot
(trying to send offer -> error not logged in -> steam-community "sessionExpired" called -> relogin using client.webLogOn(); -> use if/else and re-send trade offer)
-
Vanilla's post in How to counter incoming trade offer? was marked as the answer
Lol, so that's why I'm unable to add new item.
Now works like a charm, thanks.
manager.on('newOffer', function(offer) { if (offer.partner.getSteamID64() == admin){ //Counter an offer by adding new item var counteroffer = offer.counter(); counteroffer.addMyItem({"appid": 753, "contextid": 6, "assetid": "5222324266"}); counteroffer.send(function(err, status){ if (err){ console.log("Error: "+err); } console.log("Status: "+status) }); //confirmation } } -
Vanilla's post in AppID of a offer was marked as the answer
using 'item.appid'
https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem#appid
-
Vanilla's post in Edit Steam Profile Summary was marked as the answer
Using steamcommunity editProfile.https://github.com/DoctorMcKay/node-steamcommunity/wiki/SteamCommunity#editprofilesettings-callback
-
Vanilla's post in Not able to respond to offers because "not online" was marked as the answer
That means, tradeoffer-manager have invalid cookies, and you need to refresh cookies if that happened.
Use steamcommunity "sessionExpired" event to refresh tradeoffer-manager cookies
When you get "Error: Not Logged In", steamcommunity "sessionExpired" event will fired.
community.on("sessionExpired", function(err) { client.webLogOn(); //relogin to Steam or refresh tradeoffer-manager cookies //add your handling code here, for example: if (sendofferError == true){ //do stuff } } Edit: If you want to kill cookies for testing purposes, you can add this in your code:
setTimeout(function(){ //for debugging purposes, kill cookies after 10 second console.log("rip cookies :("); community.setCookies(["steamLogin=1||invalid", "steamLoginSecure=1||invalid"]); manager.setCookies(["steamLogin=1||invalid", "steamLoginSecure=1||invalid"]); }, 10000); -
Vanilla's post in How to get the item tags ? was marked as the answer
https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem#tags
You need to get individual item from offer, and after that just call "item.tags".
Since tags is an array, you might want to use loop to check if an item contain "Craft Item"