Created
December 17, 2021 05:11
-
-
Save itherunder/e29d1034c7aa48a66f4a1c00760bb163 to your computer and use it in GitHub Desktop.
在浏览器的控制台中发送discord 消息,下面是获取币价的示例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function send_message(message) { | |
fetch("https://discord.com/api/v9/channels/$YOUR CHANNEL ID$/messages", { | |
"headers": { | |
"accept": "*/*", | |
"accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,cy;q=0.6", | |
"authorization": "$YOUR OWN AUTHORIZATION TOKEN$", | |
"cache-control": "no-cache", | |
"content-type": "application/json", | |
"pragma": "no-cache", | |
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Microsoft Edge\";v=\"96\"", | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": "\"Windows\"", | |
"sec-fetch-dest": "empty", | |
"sec-fetch-mode": "cors", | |
"sec-fetch-site": "same-origin", | |
"x-debug-options": "bugReporterEnabled", | |
"x-discord-locale": "zh-CN", | |
"x-super-properties": "eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiQ2hyb21lIiwiZGV2aWNlIjoiIiwic3lzdGVtX2xvY2FsZSI6InpoLUNOIiwiYnJvd3Nlcl91c2VyX2FnZW50IjoiTW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzk2LjAuNDY2NC41NSBTYWZhcmkvNTM3LjM2IEVkZy85Ni4wLjEwNTQuNDMiLCJicm93c2VyX3ZlcnNpb24iOiI5Ni4wLjQ2NjQuNTUiLCJvc192ZXJzaW9uIjoiMTAiLCJyZWZlcnJlciI6Imh0dHBzOi8vd3d3LmNoYWlubmV3cy5jb20vIiwicmVmZXJyaW5nX2RvbWFpbiI6Ind3dy5jaGFpbm5ld3MuY29tIiwicmVmZXJyZXJfY3VycmVudCI6IiIsInJlZmVycmluZ19kb21haW5fY3VycmVudCI6IiIsInJlbGVhc2VfY2hhbm5lbCI6InN0YWJsZSIsImNsaWVudF9idWlsZF9udW1iZXIiOjEwODA0NCwiY2xpZW50X2V2ZW50X3NvdXJjZSI6bnVsbH0=" | |
}, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": "{\"content\":\"" + message + "\",\"tts\":false}", | |
"method": "POST", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
} | |
function query_price(coin, interval=1000*60*60) { | |
setInterval(function() { send_message('.qp ' + coin); }, interval); | |
} | |
query_price('people'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment