This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See readme for usage
- Loading branch information
Showing
6 changed files
with
379 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict' // must have 'use strict' at top | ||
|
||
const ParentBot = require('../parentbot.js').ES6; // JavaScript ES6 example | ||
const Steam = ParentBot.Steam; // Steam object | ||
|
||
const MySQL = require('mysql'); // require your own modules | ||
|
||
class ChildBot extends ParentBot { | ||
_onFriendMsg(steamID, message, type) { // overwrite default event handlers | ||
if(type === Steam.EChatEntryType.ChatMsg) { | ||
this.logger.info(steamID + ' sent: ' + message); | ||
if(message === '!prices') { | ||
Bot.steamFriends.sendMessage(steamID, 'Selling for ' + Bot.options.sellPrice); //use your custom options | ||
} | ||
} | ||
else { | ||
console.log(type); | ||
} | ||
} | ||
} | ||
|
||
let Bot = new ChildBot('username', 'password', { | ||
apikey: '1234567890987654321', // default apikey option for steam | ||
guardCode: 'ABCDE', // put guardcode here, remove after successful login | ||
sellPrice: '1 ref' // add your own options | ||
}); | ||
|
||
Bot.connect(); // connect to Steam | ||
|
||
Bot.steamTrading.on('tradeProposed', function (tradeID, steamID) { // create your own listeners | ||
Bot.steamTrading.respondToTrade(tradeID, false); | ||
Bot.logger.verbose('Trade request from ' + steamID); | ||
}); | ||
|
||
|
||
Bot.connection = MySQL.createConnection({ // add properties to the bot from an external module | ||
host: 'localhost', | ||
user: 'root', | ||
password: 'password' | ||
}); | ||
|
||
Bot.connection.connect(function (e) { // call methods on your new property | ||
if (e) Bot.logger.error('Error connecting to MySQL: ' + e) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.