Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.86 KB | None | 0 0
  1. const schedule = require('node-schedule');
  2. const cheerio = require('cheerio');
  3. const request = require('request');
  4.  
  5.  
  6. function misje() {
  7.  
  8. request('https://www.stormshield.one/a/6qjnjn', (error, response, html) => {
  9.  
  10. if (!error && response.statusCode == 200) {
  11. const channel = bot.channels.find(channel => channel.id == '617308571905818634');
  12.  
  13.  
  14. const $ = cheerio.load(html);
  15.  
  16. let xd = $('.datagrid-row').toArray();
  17. console.log(xd.length);
  18. if (xd.length == 0) {
  19. const channelerr = bot.channels.find(channel => channel.id == '619611614429315103');
  20. chanelerr.send('Nie udało się uzyskać misji z Epickim Profitem(możliwe, że aktualnie nie ma żadnych dostępnych)')
  21. return;
  22. }
  23. //let moc = xd[1].children[1].children;
  24. console.log(xd[0].children[1].children[1].data); //pokazuje moc misji
  25. console.log(xd[0].children[3].children[0].children[0].data); //pokazuje nazwę misji(np. wystrzel rakiete/naprawa schronu itp)
  26. console.log(xd[0].children[3].children[3].data) //pokazuje gdzie znajduję się misja (`dolina/twine i przedmieścia, miasto itp)
  27.  
  28. let text;
  29. // for (text of moc) {
  30.  
  31. // message.author.send('Misja ' + text + 'mocy');
  32. // }
  33. channel.send('<@&617331932786720768>' + ' Dostępnych jest: ' + xd.length + ' misji na epicki profit:')
  34.  
  35. for (let i = 0; i < xd.length; i++) {
  36.  
  37. // console.log(xd[i].children[1].children[1].data + xd[i].children[3].children[0].children[0].data + xd[i].children[3].children[3].data);
  38.  
  39. // message.author.send('Misja: ⚡' + xd[i].children[1].children[1].data + ' mocy ' + xd[i].children[3].children[0].children[0].data + ' ' + xd[i].children[3].children[3].data)
  40. let misja = new Discord.RichEmbed()
  41. .setColor('9a3ed0')
  42. .setAuthor('Misja na Epicki Profit+!', 'https://cdn.discordapp.com/attachments/617294529027899422/617469395576422526/Perk-up_epic_icon.png')
  43. misja.setDescription('**' + xd[i].children[3].children[3].data + '**' + ' \n**PERK-UP! (Epic)**\n' + (xd[1].children[3].children[0].children[0].data) + ' - ' + '``' + xd[i].children[1].children[1].data + '⚡' + '``')
  44.  
  45. channel.send(misja)
  46. }
  47.  
  48.  
  49. } else {
  50. const channel = bot.channels.find(channel => channel.id == '619611614429315103');
  51. channel.send('Połączenie nieudane. Spróbuj ponownie. Kod błędu: ' + error);
  52. };
  53. })
  54. request('https://www.stormshield.one/a/9y7zz8', (error, response, html) => {
  55. if (!error && response.statusCode == 200) {
  56. let channel = bot.channels.find(channel => channel.id == '617308571905818634');
  57.  
  58. const $ = cheerio.load(html);
  59.  
  60. let xd = $('.datagrid-row').toArray();
  61. console.log(xd.length);
  62. if (xd.length == 0) {
  63. const channelerr = bot.channels.find(channel => channel.id == '619611614429315103');
  64. channelerr.send('Nie udało się uzyskać misji z vDolcami(możliwe, że aktualnie nie ma żadnych dostępnych) ')
  65. return;
  66. }
  67. //let moc = xd[1].children[1].children;
  68.  
  69. console.log(xd[0].children[1].children[1].data); //pokazuje moc misji
  70. console.log(xd[0].children[3].children[0].children[0].data); //pokazuje nazwę misji(np. wystrzel rakiete/naprawa schronu itp)
  71. console.log(xd[0].children[3].children[3].data) //pokazuje gdzie znajduję się misja (`dolina/twine i przedmieścia, miasto itp)
  72.  
  73. let text;
  74. channel = bot.channels.find(channel => channel.id == '617308571905818634');
  75.  
  76. channel.send('<@&617331932786720768>' + ' Dostępnych jest: ' + xd.length + ' misji na vDolce:')
  77.  
  78. for (let i = 0; i < xd.length; i++) {
  79.  
  80.  
  81. let misja = new Discord.RichEmbed()
  82. .setColor('D46618')
  83. .setAuthor('Misja na vDolce!', 'https://image.fnbr.co/misc/5ab28272ca60ff5b5d8a3e72/icon.png')
  84. misja.setDescription('**' + xd[i].children[3].children[3].data + '**' + ' \n**vDolce**\n' + (xd[i].children[3].children[0].children[0].data) + ' - ' + '``' + xd[i].children[1].children[1].data + '⚡' + '``')
  85.  
  86. channel.send(misja)
  87. }
  88.  
  89.  
  90. } else {
  91. const channel = bot.channels.find(channel => channel.id == '619611614429315103');
  92. channel.send('Połączenie nieudane. Spróbuj ponownie. Kod błędu: ' + error);
  93. };
  94. })
  95.  
  96.  
  97.  
  98. request('https://www.stormshield.one/a/9vfaxs', (error, response, html) => {
  99. if (!error && response.statusCode == 200) {
  100. const channel = bot.channels.find(channel => channel.id == '617308571905818634');
  101.  
  102. const $ = cheerio.load(html);
  103.  
  104. let xd = $('.datagrid-row').toArray();
  105. console.log(xd.length);
  106. if (xd.length == 0) {
  107. const channelerr = bot.channels.find(channel => channel.id == '619611614429315103');
  108. chanelerr.send('Nie udało się uzyskać misji z Legendarnym Profitem(możliwe, że aktualnie nie ma żadnych dostępnych) ')
  109. return;
  110. }
  111. //let moc = xd[1].children[1].children;
  112. console.log(xd[1].children[1].children[1].data); //pokazuje moc misji
  113. console.log(xd[1].children[3].children[0].children[0].data); //pokazuje nazwę misji(np. wystrzel rakiete/naprawa schronu itp)
  114. console.log(xd[1].children[3].children[3].data) //pokazuje gdzie znajduję się misja (`dolina/twine i przedmieścia, miasto itp)
  115.  
  116. let text;
  117.  
  118. channel.send('<@&617331932786720768>' + ' Dostępnych jest: ' + xd.length + ' misji na Legendarny Profit:')
  119.  
  120. for (let i = 0; i < xd.length; i++) {
  121.  
  122.  
  123. let misja = new Discord.RichEmbed()
  124. .setColor('D46618')
  125. .setAuthor('Misja na Legendarny Profit!', 'https://gamepedia.cursecdn.com/fortnite_gamepedia/5/5b/Perk-up_legendary_icon.png')
  126. misja.setDescription('**' + xd[i].children[3].children[3].data + '**' + ' \n**Legendarny Profit**\n' + (xd[1].children[3].children[0].children[0].data) + ' - ' + '``' + xd[i].children[1].children[1].data + '⚡' + '``')
  127.  
  128. channel.send(misja)
  129. }
  130.  
  131.  
  132. } else {
  133. const channel = bot.channels.find(channel => channel.id == '619611614429315103');
  134. channel.send('Połączenie nieudane. Spróbuj ponownie. Kod błędu: ' + error);
  135. };
  136. })
  137. }
  138.  
  139.  
  140. var j = schedule.scheduleJob('00 12 * * *', misje);
  141. var j = schedule.scheduleJob('00 00 * * *', misje);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement