Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const SteamUser = require('steam-user');
- const SteamTotp = require('steam-totp');
- const SteamCommunity = require('steamcommunity');
- const TradeOfferManager = require('steam-tradeoffer-manager');
- const config = require('./config.json');
- var botSID;
- const client = new SteamUser();
- const community = new SteamCommunity();
- const manager = new TradeOfferManager ({
- steam: client,
- community: community,
- language: 'en'
- });
- const logOnOptions = {
- accountName: config.username,
- password: config.password,
- twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret)
- };
- client.logOn(logOnOptions);
- client.on('loggedOn', () => {
- console.log('succesfully logged on.');
- client.setPersona(SteamUser.Steam.EPersonaState.Online);
- client.gamesPlayed(["Hogjuulelt hiigdej bn", 570]);
- botSID = client.steamID.toString();
- });
- client.on("friendMessage", function(steamID, message) {
- console.log(steamID + " is messaging me. Message: " + message);
- if (message == "hi") {
- client.chatTyping(steamID);
- client.chatMessage(steamID, "Sain. Sain baina uu?");
- }else if (message == "info") {
- client.chatMessage(steamID, "Ene bol mongolchuudiin bie bieniigee scam-dah buyu luivardahiig bagasagahiin tuld hiigdsen automat bot yum. Tovchoor middlemanii uurgiig guitsetgene.");
- client.chatMessage(steamID, "Aldsan hun arvan tamtai gegcheer arvan tamiig medersen hunii huvid enehuu bot-g hiisen ba neg ch gesen hund tus boloosoi gej husej baina.");
- client.chatMessage(steamID, "Admin minii bie ymarvaa neg ashig haraagui bolno.");
- client.chatMessage(steamID, "Uilchilgeenii talaar delgerenguig 'service' commandaas avna uu...Bayarlalaa.");
- client.chatMessage(steamID, "Hundetgesen, Tvman99");
- }else if (message == "service") {
- client.chatMessage(steamID, "ANHAARUULGA: BOT HEZEE CH TANIIG ADD HIIHGUI!!! Herev adilhan zuragtai, nertei friend request irvel blocklooroi.");
- client.chatMessage(steamID, "Trade hiih gej baigaa 2 hun 2-uulaa bot-toi naiz baih shaardlagatai. Bot-nii steam profile link-g 'botlink' commandaas avna uu.");
- client.chatMessage(steamID, "Uilchilgeenii zaavar...Turshiltiin shatand orsnii daraa bichigdene.");
- client.chatMessage(steamID, "Uilchilgeenii tolbor: UNEGUI!");
- client.chatMessage(steamID, "Donation/Handiv ogj bolno. 'donation' commandaas...");
- }else if (message == "donation") {
- client.chatMessage(steamID, "Yunii turuund hodolmoriig mine unelj handiv ogoh gej baigaa tand tuiliin ih talarhaj baigaagaa ilerhiileh ni zuitei bolov uu.");
- client.chatMessage(steamID, "MASH IH BAYARLALAA");
- client.chatMessage(steamID, "Ta daraah linkeer orj handivaa ogno uu!");
- client.chatMessage(steamID, "https://steamcommunity.com/tradeoffer/new/?partner=165896716&token=KJurf_1N");
- }else if (message == "fb") {
- client.chatMessage(steamID, "Adminii facebook: https://www.facebook.com/tvman99");
- }else if (message == "steam") {
- client.chatMessage(steamID, "Adminii steam: https://steamcommunity.com/id/tvman99/");
- }else if (message == "contact") {
- client.chatMessage(steamID, "Ta admintai facebook bolon steam-r holboo barih bolomjtoi.");
- client.chatMessage(steamID, "Adminii facebook-g 'fb', steam-g 'steam' commandiig ashiglaj harna uu.");
- }else if (message == "botlink") {
- client.chatMessage(steamID, "Enehuu botnii profile link: https://steamcommunity.com/profiles/"+ botSID +"/");
- client.chatMessage(steamID, "Ta linkiig trade hiih nogoo hundee ogsnoor nogoo hun tani botiig naizaaraa nemeh bolomjtoi bolno.");
- }else if (message == "help") {
- client.chatMessage(steamID, "'hi', 'help', 'fb', 'steam', 'contact', 'botlink', 'info', 'service', 'donation' zereg commanduud baigaa.");
- }else if(steamID != config.ownerID) {
- client.chatMessage(steamID, "'help' commandiig ashiglaj commanduudiin jagsaaltiig harna uu!");
- }
- });
- client.on('friendRelationship', function(steamID, relationship) {
- if (relationship == SteamUser.Steam.EFriendRelationship.Friend) {
- console.log("I am now friends with " + steamID.getSteamID64());
- client.chatMessage(steamID, "Hi! :)");
- client.chatMessage(steamID, "Ene bot hogjuuleltiin shatandaa yavj baigaa bolno!");
- }
- else if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
- console.log(steamID + " added me");
- // Add the user.
- addFriend(steamID);
- }
- });
- // This is emitted when we have our friendslist after logon.
- client.on("friendsList", function() {
- // Loop all users that we have relations with.
- // Ignored, blocked etc...
- for (var steamid64 in client.myFriends) {
- // This is the relation we have with the user.
- var relationship = client.myFriends[steamid64];
- // Check if they send us a friend request
- // I am pretty sure that this will also be true if the bot send the user a friend request, but you can just ignore that for now.
- if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
- // Add them back.
- addFriend(steamid64);
- }
- }
- });
- function addFriend(steamID) {
- client.addFriend(steamID);
- }
- client.on('webSession', (sessionid, cookies) => {
- manager.setCookies(cookies);
- community.setCookies(cookies);
- community.startConfirmationChecker(20000, config.identitySecret);
- });
- function acceptOffer(offer) {
- offer.accept((err) => {
- community.checkConfirmations();
- console.log("We Accepted an offer");
- if (err) console.log("There was an error accepting the offer.");
- });
- }
- function declineOffer(offer) {
- offer.decline((err) => {
- console.log("We Declined an offer");
- if (err) console.log("There was an error declining the offer.");
- });
- }
- function processOffer(offer) {
- if (offer.isGlitched() || offer.state === 11) {
- console.log("Offer was glitched, declining.");
- declineOffer(offer);
- } else if (offer.partner.getSteamID64() === config.ownerID) {
- console.log("Offer was sent from admin, accepting.");
- acceptOffer(offer);
- } else {
- console.log("Offer was sent from stranger, declining.");
- declineOffer(offer);
- }
- }
- client.setOption("promptSteamGuardCode", false);
- manager.on('newOffer', (offer) => {
- processOffer(offer);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement