Jump to content
McKay Development

Recommended Posts

Posted

Hello, Everyone

 

What I am trying to do is use Telegram and my own bot there to start and stop the steam idle bot my current code is below.So the problem I am having is I have no clue as to how to tell the bot to start playing a game from what I understand "client.on('loggedOn', function(details)" is what happens when the bot has logged on when i put "client.gamesPlayed([107410]);" it plays Arma 3 right when it log's on but I want it to stop and play

another game and such. Really appreciate all feedback.

 

 

 

var TelegramBot = require('node-telegram-bot-api');

var SteamUser = require('steam-user');
var prompt = require('prompt');

const bot = new TelegramBot(TOKEN, {polling: true});


function steamlogin()
{
 
var SteamUser = require('steam-user');
var prompt = require('prompt');
 
var client = new SteamUser();
var prompt = require('prompt');
 
var properties = [
{
name: 'username',
validator: /^[a-zA-Z\s\-]+$/,
warning: 'Username must be only letters, spaces, or dashes'
},
{
name: 'password',
replace: '*',
hidden: true
}
];
 
prompt.start();
 
prompt.get(properties, function (err, result) {
if (err) { return onErr(err); }
console.log('Thank you for logging in.');
 
client.logOn({
"accountName": result.username,
"password": result.password
});
 
});
 
function onErr(err) {
console.log(err);
return 1;
}

client.on('loggedOn', function(details) {
console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
client.setPersona(SteamUser.EPersonaState.Online);
 
});
 
}

function arma3()
{
client.gamesPlayed([107410]);
}

bot.onText(/\/login/, (msg) =>
{
steamlogin();
bot.sendMessage(msg.chat.id,"Starting Login Process. SEE TERMINAL FOR MORE INFO");
});

bot.onText(/\/arma/, (msg) =>
{
bot.sendMessage(msg.chat.id,"Started Arma 3");
arma3();
});

 

Posted

Yes, i figured out the problem. Thanks to @Vanilla and thank you Dr.McKay for all your hard work and dedication.

 

Here is the working code if anyone wants it.

var TelegramBot = require('node-telegram-bot-api');
var SteamUser = require('steam-user');
var prompt = require('prompt');

const TOKEN = 'YOUR TOKEN HERE';
const bot = new TelegramBot(TOKEN, {polling: true});

var client = new SteamUser();

function steamlogin()
{
    
    var properties = [
      {
        name: 'username', 
        validator: /^[a-zA-Z\s\-]+$/,
        warning: 'Username must be only letters, spaces, or dashes'
      },
      {
        name: 'password',
        replace: '*',
        hidden: true
      }
    ];
    
    prompt.start();
    
    prompt.get(properties, function (err, result) {
      if (err) { return onErr(err); }
      console.log('Thank you for logging in.');
     
      client.logOn({
        "accountName": result.username,
        "password": result.password
      });
    
    });
    
    function onErr(err) {
      console.log(err);
      return 1;
    }

    client.on('loggedOn', function(details) {
        console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
        client.setPersona(SteamUser.EPersonaState.Online);
    });
    
}

function arma3()
{
    client.gamesPlayed([123456]);
}

bot.onText(/\/login/, (msg) => 
{
    steamlogin();
    bot.sendMessage(msg.chat.id,"Starting Login Process. SEE TERMINAL TO COMPLETE THE PROCESS");
});

bot.onText(/\/arma/, (msg) => 
{
    bot.sendMessage(msg.chat.id,"Started Arma 3");
    arma3();
});

bot.onText(/\/none/, (msg) => 
{
	client.gamesPlayed([]);
});

bot.onText(/\/kill/, (msg) => 
{
    bot.sendMessage(msg.chat.id,"Process Killed");
    process.exit()
});

bot.onText(/\/help/, (msg) => 
{
        bot.sendMessage(msg.chat.id,"/login = Login");
	bot.sendMessage(msg.chat.id,"/arma = Start playing Games");
	bot.sendMessage(msg.chat.id,"/none = Stop playing games");
	bot.sendMessage(msg.chat.id,"/kill = Kill the process");
});

  • 2 months later...

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...