Advertisement
Guest User

Untitled

a guest
Aug 31st, 2018
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. const SteamUser = require('steam-user');
  2. const SteamTotp = require('steam-totp');
  3. const SteamCommunity = require('steamcommunity');
  4. const TradeOfferManager = require('steam-tradeoffer-manager');
  5. const config = require('./config.json');
  6.  
  7. const client = new SteamUser();
  8. const community = new SteamCommunity();
  9. const manager = new TradeOfferManager ({
  10. steam: client,
  11. community: community,
  12. language: 'en'
  13. });
  14.  
  15. const logOnOptions = {
  16. accountName: config.username,
  17. password: config.password
  18. twoFactorCode: SteamTotp.generateAuthCode("")
  19. };
  20.  
  21. client.logOn(logOnOptions);
  22.  
  23. client.on('loggedOn', () => {
  24. console.log('succesfully logged on.');
  25. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  26. client.gamesPlayed(440);
  27. client.gamesPlayed(["15 days Trade Ban"]);
  28. });
  29.  
  30. client.on("friendMessage", function(steamID, message) {
  31. if (message == "!help") {
  32. client.chatMessage(steamID, "Commands:");
  33. client.chatMessage(steamID, "!owner - show my owner profile, if you have any problems you may contact me!");
  34. client.chatMessage(steamID, "");
  35. client.chatMessage(steamID, "!buygems [amount of sets] - use to buy that amount of sets for gems, following the current BOT rate");
  36. }
  37. if (message == "!owner") {
  38. client.chatMessage(steamID, "There is something wrong?");
  39. client.chatMessage(steamID, "Let me know if you're experiencing issues with my bot!");
  40. client.chatMessage(steamID, "https://steamcommunity.com/id/z-fortex/");
  41. }
  42. if (message == "!buygems") {
  43. client.chatMessage(steamID, "Error 404");
  44. }
  45. });
  46.  
  47. client.on('friendRelationship', function(sid, relationship) {
  48. if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
  49. console.log("We recieved a friend request from "+sid);
  50. client.addFriend(sid, function (err, name) {
  51. if (err) {
  52. console.log(err);
  53. return;
  54. }
  55. console.log("Accepted user with the name of "+name)
  56. client.chatMessage(sid, "Hey, thanks for add me!, you may type !help for instructions");
  57. })
  58. }
  59.  
  60. })
  61.  
  62. client.on('groupRelationship', function(sid, relationship) {
  63. if (relationship == SteamUser.EClanRelationship.Invited) {
  64. console.log("We were asked to join steam group #"+sid);
  65. client.respondToGroupInvite(sid, true);
  66. }
  67. })
  68.  
  69. client.on('friendsList', function() {
  70. for (var sid in client.myFriends);
  71. var relationship = client.myFriends[sid]
  72. if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
  73. console.log("(offline) We recieved a friend request from "+sid);
  74. client.addFriend(sid, function (err, name) {
  75. if (err) {
  76. console.log(err);
  77. return;
  78. }
  79. console.log("(offline) Accepted user with the name of "+name)
  80. })
  81. }
  82. })
  83.  
  84. client.on('groupList', function() {
  85. for (var sid in client.myGroups);
  86. var relationship = client.myGroups[sid];
  87. if (relationship == SteamUser.EClanRelationship.Invited) {
  88. console.log("(offline) We were asked to join steam group #"+sid);
  89. client.respondToGroupInvite(sid, true);
  90. }
  91. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement