Advertisement
sparkychild

Private Bot Hosting

Aug 21st, 2015
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. For those who would like have their own bot, I will start hosting bots for EOS bucks. To 'order' a bot simply fill out the form found on https://waa.ai/eos-privatebot and transfer 25 bucks to sparkychild.
  2.  
  3. Pricing:
  4. - 21 EOS bucks per week;
  5. - 4 bucks to get it set up
  6.  
  7. Additional commands:
  8. -time - check the amount of time left before the bot goes down
  9. -monitor [on|off] - enable/disable resource monitor; prevents spam of commands from all non-DEV users
  10.  
  11. To keep the bot up, simply transfer bucks to YOUR private bot (NOT sparkyboTTT) and it will increase the time that it will stay on.
  12.  
  13.  
  14. ***ADDITIONAL DETAILS ON THE BOT'S INNER WORKINGS REGARDING TIME DEDUCTION***
  15.  
  16. If at any time the bot goes down, time will NOT be deducted:
  17.  
  18.  
  19. Code used to deduct time:
  20.  
  21. var d = Date.parse(new Date())
  22. var difference = d - now;
  23. now = d;
  24. this.time = this.time - difference;
  25. if (this.time <= 0) {
  26. var timer = JSON.parse(fs.readFileSync('time.json'));
  27. timer[toId(config.nick)] === this.time;
  28. fs.writeFileSync('time.json', JSON.stringify(timer));
  29. process.exit(-1)
  30. }
  31.  
  32. This is what's used to deduct time, so if the bot isn't on, nothing will get deducted.
  33.  
  34. As payment is made to your private bot, it is advised to NOT use the bot as a personal bank, as all the funds will be redirected to sparkyboTTT, in exchange for uptime. On this note, only the one who BOUGHT the Bot can pay to extend the time; no one else is able to do so.
  35.  
  36. Deducted time is updated at 1 minute intervals:
  37.  
  38. setInterval(function() {
  39. var timer = JSON.parse(fs.readFileSync('time.json'));
  40. timer[toId(config.nick)] = this.time;
  41. fs.writeFileSync('time.json', JSON.stringify(timer));
  42. }.bind(this), 60000);
  43.  
  44. To prevent data loss, uptime purchases are immediately updated, rather than updated at 1 minute intervals for deductions:
  45.  
  46. parseTransfer: function(text) {
  47. if (text.split(' has transferred ').length < 2) return;
  48. var user = text.split(' has transferred ')[0];
  49. var amount = text.split(' has transferred ')[1].split(' buck')[0] * 1;
  50. if (typeof amount !== 'number') {
  51. if (text.split(' has transferred ').length < 3) return;
  52. user += ' has transferred ';
  53. amount = text.split(' has transferred')[2].split(' buck')[0] * 1
  54. }
  55. if (config.excepts.indexOf(toId(user)) === -1) return;
  56. send('|/transferbucks sparkyboTTT, ' + amount);
  57. send('|/pm ' + user + ', You have bought another ' + amount * 8 + ' hours of uptime!');
  58. this.time += amount * 8 * 60 * 60 * 1000;
  59. var timer = JSON.parse(fs.readFileSync('time.json'));
  60. timer[toId(config.nick)] = this.time;
  61. fs.writeFileSync('time.json', JSON.stringify(timer));
  62. },
  63.  
  64. As soon as the bot recieves the transfer, it will send it over to sparkyboTTT, and update it into its data files.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement