This repository has been archived on 2024-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
line-bot-js/LineNotifyClass.js

35 lines
947 B
JavaScript
Raw Permalink Normal View History

2023-01-10 04:01:05 +00:00
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
/** LineNotify */
class LineNotifyClass {
Send(message) {
const data = `message=\n${message}`;
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
// console.log(this.responseText);
}
});
xhr.open("POST", "https://notify-api.line.me/api/notify");
xhr.setRequestHeader("Authorization", "Bearer Dkv8Yh1Li3XsKFqZkmFMNP5o0JDSvan7qfcDmSv9GJr");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
}
SendBadmintonNotify() {
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
// console.log(this.responseText);
}
});
xhr.open("POST", "http://jianmiau.tk:1880/BadmintonNotify");
xhr.send();
}
}
module.exports = LineNotifyClass