Jump to content
McKay Development

Node-steam auto message friends


DGVaniX

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...
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 by xLeeJYx
Link to comment
Share on other sites

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) {
Link to comment
Share on other sites

 

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 by xLeeJYx
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...