Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. /*
  2. * Steam-Friend-Advertiser
  3. * Created by: Laterbreh
  4. * Description: This script was designed to easily send every user on your friends list a message. You DO NOT need to be logged out of the client.
  5. * Installation: npm install steam-user, npm install sleep
  6. */
  7. var SteamUser = require('steam-user');
  8. var client = new SteamUser();
  9. var sleep = require('sleep');
  10. const readline = require('readline');
  11. const rl = readline.createInterface({
  12. input: process.stdin,
  13. output: process.stdout
  14. });
  15. rl.question('Username: ', function (accountname) {
  16. rl.question('Password: ', function (password) {
  17. rl.question('Message that you would like to send to your friends list: ', function (message) {
  18. doLogin(accountname, password, message);
  19. rl.close();
  20. });
  21. });
  22. });
  23. function doLogin(accountname, password, message) {
  24. client.logOn({
  25. "accountName": accountname,
  26. "password": password
  27. });
  28. client.on('loggedOn', function (details) {
  29. console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
  30. //console.log(details);
  31. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  32. });
  33. client.on('error', function (e) {
  34. console.log('ERROR: ' + e);
  35. });
  36. client.on('friendsList', function () {
  37. console.log('Number of friends to send a message to: ' + Object.keys(client.myFriends).length);
  38. var count = 0;
  39. for (var key in client.myFriends) {
  40. if (client.myFriends.hasOwnProperty(key)) {
  41. count++;
  42. //Comment out line 43 if you want to risk it... Current delay is 2 seconds between each message.
  43. sleep.sleep(2);
  44. console.log('Sending Message Number: ' + count);
  45. client.chatMessage(key, message);
  46.  
  47. }
  48. }
  49. });
  50. client.on('friendMessage', function (steamID, message) {
  51. console.log("Friend message from " + steamID.getSteam3RenderedID() + ": " + message);
  52. });
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement