Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Logi czatu Jaruna
  3. // @version 1.0
  4. // @description Zapisuje mi na diskordzie logi z czatu.
  5. // @author Adison
  6. // @match http://zemyna.margonem.pl/
  7. // @grant none
  8. // ==/UserScript==
  9. (function(webhook_url){
  10. function sendToDiscord(nick, txt, option){
  11. switch(option){
  12. case 0:
  13. txt = "O " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
  14. break;
  15. case 1:
  16. txt = "K " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
  17. break;
  18. case 2:
  19. txt = "G " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
  20. break;
  21. case 3:
  22. txt = "```«" + nick + "»" + "(" + ut_time(unix_time()) + ") " + txt + "```";
  23. break;
  24. }
  25. $.ajax({
  26. data: JSON.stringify({
  27. "content": txt,
  28. }),
  29. dataType: 'json',
  30. processData: false,
  31. type: 'POST',
  32. url: webhook_url,
  33. });
  34. }
  35. g.chat.parsers.push(function(ch) {
  36. let tmpnick = "";
  37. if(ts() / 1000 - ch.ts <= 2 && ch.n != ""){
  38. tmpnick = ch.n;
  39. if(ch.k == 3){
  40. tmpnick = `${ch.n} -> ${ch.nd}`;
  41. }
  42. sendToDiscord(tmpnick, ch.t, parseInt(ch.k));
  43. }
  44. })
  45. })("https://discordapp.com/api/webhooks/636257741807026216/LtP2pBFIQ65yIrZ5XYrPdc8dTyJf40YiahIO8z0ftJlRD7ORJgLt2dJkFq5VkHVUdNPY")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement