Uzenetek

Üzenetet küld

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/391769/865468/Uzenetek.js

  1. // ==UserScript==
  2. // @name Uzenetek
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description Üzenetet küld
  6. // @author vacsati
  7. // @match *
  8. // ==/UserScript==
  9.  
  10. function telegram(chat,bot,message){
  11. $.ajax({
  12. type: 'GET',
  13. url: "https://api.telegram.org/bot"+bot+"/sendmessage?chat_id="+chat+"&text="+encodeURIComponent(message),
  14. success: function(response){console.log("Telegram: ok - ",message);},
  15. error: function(response){console.error("Telegram error:",response.responseText);}
  16. });
  17. }
  18. function discord_wm(webhook,data){
  19. $.ajax({
  20. type: 'POST',
  21. url: webhook,
  22. data: data,
  23. success: function(response){console.log("Discord: ok");},
  24. error: function(response){console.error("Discord error:",response.responseText);}
  25. });
  26. }
  27. function discord_cbm(channel,bot,message){
  28. var data = {
  29. "content": message,
  30. "tts": false
  31. };
  32. $.ajax({
  33. type: 'POST',
  34. url: 'https://discordapp.com/api/v6/channels/' + channel + '/messages',
  35. data: JSON.stringify(data),
  36. headers: {
  37. '%3Aauthority': 'discordapp.com',
  38. '%3Amethod': 'POST',
  39. '%3Apath': '/api/v6/channels/' + channelId + '/messages',
  40. '%3Ascheme': 'https',
  41. 'Authorization': 'Bot ' + bot,
  42. 'Content-Type': 'application/json'
  43. },
  44. success: function(response) {console.log("Discord channel: ok",message);},
  45. error: function(response) {console.error("Discord channel error:",response.responseText);}
  46. });
  47. }