Advertisement
Justin170055

Chat bot!

Mar 7th, 2016
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. var Steam = require("steam");
  2. var SteamUser = require('steam-user'); // Replace this with `require('steam-user');` if used outside of the module directory
  3. var client = new SteamUser();
  4.  
  5. var friends = new Steam.SteamFriends(client.client);
  6.  
  7. client.logOn({
  8. "accountName": "Username",
  9. "password": "password"
  10. });
  11.  
  12. client.on('loggedOn', function(details) {
  13. console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
  14. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  15. client.gamesPlayed(440);
  16. });
  17.  
  18. client.on('error', function(e) {
  19. // Some error occurred during logon
  20. console.log("WARNING: Error found in the Code");
  21. });
  22.  
  23. client.on('webSession', function(sessionID, cookies) {
  24. console.log("Got web session");
  25. // Do something with these cookies if you wish
  26. });
  27.  
  28. client.on('newItems', function(count) {
  29. console.log(count + " new items in our inventory");
  30. });
  31.  
  32. client.on('emailInfo', function(address, validated) {
  33. console.log("Our email address is " + address + " and it's " + (validated ? "validated" : "not validated"));
  34. });
  35.  
  36. client.on('wallet', function(hasWallet, currency, balance) {
  37. console.log("Our wallet balance is " + SteamUser.formatCurrency(balance, currency));
  38. });
  39.  
  40. client.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) {
  41. var limitations = [];
  42.  
  43. if(limited) {
  44. limitations.push('LIMITED');
  45. }
  46.  
  47. if(communityBanned) {
  48. limitations.push('COMMUNITY BANNED');
  49. }
  50.  
  51. if(locked) {
  52. limitations.push('LOCKED');
  53. }
  54.  
  55. if(limitations.length === 0) {
  56. console.log("Our account has no limitations.");
  57. } else {
  58. console.log("Our account is " + limitations.join(', ') + ".");
  59. }
  60.  
  61. if(canInviteFriends) {
  62. console.log("Our account can invite friends.");
  63. }
  64. });
  65.  
  66. client.on('vacBans', function(numBans, appids) {
  67. console.log("We have " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + ".");
  68. if(appids.length > 0) {
  69. console.log("We are VAC banned from apps: " + appids.join(', '));
  70. }
  71. });
  72.  
  73. client.on('licenses', function(licenses) {
  74. console.log("Our account owns " + licenses.length + " license" + (licenses.length == 1 ? '' : 's') + ".");
  75. });
  76.  
  77. // Messages:
  78. friends.on("friendMsg", function(user, msg, type){
  79. if(type == Steam.EChatEntryType.ChatMsg){
  80. if(msg == "ping"){
  81. friends.sendMessage(user, "Pong!");
  82. }
  83. if(msg == "hello"){
  84. friends.sendMessage(user, "Hello!");
  85. }
  86. if(msg == "how are you"){
  87. friends.sendMessage(user, "Im doing great!");
  88. }
  89. if(msg == "would you like to trade?"){
  90. friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
  91. }
  92. if(msg == "check your trade offers"){
  93. friends.sendMessage(user, "I already have!");
  94. }
  95. if(msg == "Would you like to trade?"){
  96. friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
  97. }
  98. if(msg == "would you like to trade"){
  99. friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
  100. }
  101. else(msg == ""){
  102. friends.sendMessage(user, "My responses are limited please ask the right questions. :)");
  103. }
  104. }
  105. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement