Jump to content

How to implement the lightning bolt for my trade bot


PlanZed

Recommended Posts

I am currently coding my own trading bot in node.js and I want to know how I would get the lightning bolt to show that it is a bot.

Link to comment
Share on other sites

POST request to 'https://backpack.tf/api/aux/heartbeat/v1' with query string containing "token" as your user token and "automatic" as "all".

Link to comment
Share on other sites

2 hours ago, Vortegan said:

POST request to 'https://backpack.tf/api/aux/heartbeat/v1' with query string containing "token" as your user token and "automatic" as "all".

So I am new to node.js (just learned it yesterday) How would I write out the query string?

Link to comment
Share on other sites

9 hours ago, PlanZed said:

So I am new to node.js (just learned it yesterday) How would I write out the query string?

npm install request-promise

 

const requestPromise = require("request-promise");

	heartbeat () {
		return new Promise((resolve, reject) => {
			requestPromise({method: 'POST', url: this.baseUrl + 'aux/heartbeat/v1', qs: {'token': this.access_token, "automatic": "all"}, json: true})
			.then(function (body) {
				if (body.hasOwnProperty('bumped')) resolve(true);
				else reject(body);
			}).catch(function (err) {
				reject(err);  //  api request error
			})
		});
	}

replace this.baseUrl with 'https://backpack.tf/api/", this.acces_token with your access token

Link to comment
Share on other sites

7 hours ago, srg-n said:

npm install request-promise

 

const requestPromise = require("request-promise");

	heartbeat () {
		return new Promise((resolve, reject) => {
			requestPromise({method: 'POST', url: this.baseUrl + 'aux/heartbeat/v1', qs: {'token': this.access_token, "automatic": "all"}, json: true})
			.then(function (body) {
				if (body.hasOwnProperty('bumped')) resolve(true);
				else reject(body);
			}).catch(function (err) {
				reject(err);  //  api request error
			})
		});
	}

replace this.baseUrl with 'https://backpack.tf/api/", this.acces_token with your access token

When I run that code I get this error
 

C:\Users\Valkyrie\Desktop\Trading Bot>node bot.js
C:\Users\Valkyrie\Desktop\Trading Bot\bot.js:34
heartbeat() {
            ^

SyntaxError: Unexpected token '{'
[90m    at wrapSafe (internal/modules/cjs/loader.js:1047:16)[39m
[90m    at Module._compile (internal/modules/cjs/loader.js:1097:27)[39m
[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)[39m
[90m    at Module.load (internal/modules/cjs/loader.js:977:32)[39m
[90m    at Function.Module._load (internal/modules/cjs/loader.js:877:14)[39m
[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)[39m
[90m    at internal/main/run_main_module.js:18:47[39m

What should I do to fix this?

Link to comment
Share on other sites

22 hours ago, PlanZed said:

When I run that code I get this error
 

C:\Users\Valkyrie\Desktop\Trading Bot>node bot.js
C:\Users\Valkyrie\Desktop\Trading Bot\bot.js:34
heartbeat() {
            ^

SyntaxError: Unexpected token '{'
[90m    at wrapSafe (internal/modules/cjs/loader.js:1047:16)[39m
[90m    at Module._compile (internal/modules/cjs/loader.js:1097:27)[39m
[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)[39m
[90m    at Module.load (internal/modules/cjs/loader.js:977:32)[39m
[90m    at Function.Module._load (internal/modules/cjs/loader.js:877:14)[39m
[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)[39m
[90m    at internal/main/run_main_module.js:18:47[39m

What should I do to fix this?

its quoted from my backpack.tf api wrapper class, add "function" before "hearbeat" if you are trying to declare it as a global function

like this: function heartbeat () {

Link to comment
Share on other sites

17 minutes ago, srg-n said:

its quoted from my backpack.tf api wrapper class, add "function" before "hearbeat" if you are trying to declare it as a global function

like this: function heartbeat () {

I face palmed for not thinking of that. Thank you so much! You are a legend!

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...