Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. Komenda ma automatycznie, o danej godzinie, restartować bota i wysyłać wiadomość na dany kanał (wiem, że nie jest zdefiniowany, ale nie wiem gdzie to zrobić)
  2.  
  3.  
  4. // reset, resetcommand, restart, restarbota, bot-reset
  5. async function verifyTime4() {
  6. var d = new Date();
  7. if((d.getHours == 19) && (d.getMinutes == 0)) {
  8. client.on('message', message => {
  9. if (!message.author.id == '190755326637768704') return;
  10. switch (message.content.toUpperCase()) {
  11. case '?RESET':
  12. resetBot(message.channel);
  13. break;
  14. }
  15.  
  16.  
  17. function resetBot(channel) {
  18. const restartEmbed = new Discord.RichEmbed();
  19. restartEmbed.addField('**Cykliczna konserwacja Papaja**', 'Cykliczna konserwacja bota <@688758377253568528> **właśnie się zaczyna!**', true);
  20. restartEmbed.setColor(kolory.cream);
  21. restartEmbed.setFooter('Papaj v2.0 | Kazik#2642', client.user.displayAvatarURL);
  22. client.channels.get('692397972431831041').send(restartEmbed)
  23. .then(msg => client.destroy())
  24. .then(() => client.login(TOKEN));
  25.  
  26. const porestarcieEmbed = new Discord.RichEmbed();
  27. porestarcieEmbed.addField('**Cykliczna konserwacja Papaja**', 'Cykliczna konserwacja bota <@688758377253568528> **powiodła się!**', true);
  28. porestarcieEmbed.setColor(kolory.green);
  29. porestarcieEmbed.setFooter('Papaj v2.0 | Kazik#2642', client.user.displayAvatarURL);
  30. client.on('ready', () => {
  31. console.log('Już po restarcie!');
  32. client.channels.get('692397972431831041').send(porestarcieEmbed);
  33.  
  34. });
  35.  
  36. };
  37. });
  38. };
  39. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement