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
2023-01-10 12:01:05 +08:00

35 lines
947 B
JavaScript

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