DGVaniX Posted June 16, 2017 Report Posted June 16, 2017 Hi, so I need a bit of help on making a bot using node-steam, and I've noticed that there's only node-steam-user on this forum which might not be the same as node-steam so I thought I might as well post in general. I'm making this bot and I want it to automatically message people who message the bot with a predefined message: var Steam = require('steam'); var fs = require('fs'); var bot = new Steam.SteamClient(); if (fs.existsSync('sentryfile_' + process.argv[2])){ var sentry = fs.readFileSync('sentryfile_' + process.argv[2]); console.log('[BOT] logging in with sentry '); bot.logOn({ accountName: process.argv[2], password: process.argv[3], authCode: process.argv[5], shaSentryfile: sentry }); }else{ console.log('[BOT] logging in without sentry'); bot.logOn({ accountName: process.argv[2], password: process.argv[3], authCode: process.argv[5] }); } This is my first bot in js and I can't see the predefined functions of node-steam anywhere... Thanks. Quote
xLeeJYx Posted June 25, 2017 Report Posted June 25, 2017 (edited) var SteamUser = require('steam-user') var client = new SteamUser(); //Commands client.on('friendMessage', function (steamID, message) { if(message == "!help"){ client.chatMessage(steamID, '\n' + 'These are the commands I have :' + '\n' + '!help' + '\n' + '!prices' + '\n' + '!owner'); } else if(message == "!prices"){ client.chatMessage(steamID, '\n' + 'Buy: 1 scrap \(0.11 ref\) \(Each\)' + '\n' + 'Sell: 2 scrap \(0.22\) \(Each\)'); } else if(message == "!owner"){ client.chatMessage(steamID, '\n' + 'My owner is LeeTheGayKid') } else { client.chatMessage(steamID, 'I don\'t understand what you are trying to say, try !help instead'); } }); This the code i used on my bot, feel free to edit Edited June 25, 2017 by xLeeJYx Quote
Vanilla Posted June 25, 2017 Report Posted June 25, 2017 This the code i used on my bot, feel free to edit If you use steam-user, those code should be works.Don't forget that you need to logged in to chat so bot will listen to chat command. client.setPersona(5); //put this on: client.on('loggedOn', function (details) { Quote
xLeeJYx Posted June 26, 2017 Report Posted June 26, 2017 (edited) If you use steam-user, those code should be works.Don't forget that you need to logged in to chat so bot will listen to chat command. client.setPersona(5); //put this on: client.on('loggedOn', function (details) { haha forgot to write that for him, i have that on my code Edited June 26, 2017 by xLeeJYx Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.