refactor: remove flumm-fetch dependency

This commit is contained in:
2025-03-19 11:47:26 +01:00
parent ca114f677e
commit 2d13c865af
5 changed files with 39 additions and 18 deletions

15
dist/clients/tg.js vendored
View File

@ -1,4 +1,3 @@
import fetch from "flumm-fetch";
import EventEmitter from "events";
const allowedFiles = ["audio", "video", "photo", "document"];
export default class tg extends EventEmitter {
@ -14,6 +13,12 @@ export default class tg extends EventEmitter {
user: new Map(),
me: {},
};
emit(event, ...args) {
return super.emit(event, ...args);
}
on(event, listener) {
return super.on(event, listener);
}
constructor(options) {
super();
this.options = {
@ -143,7 +148,13 @@ export default class tg extends EventEmitter {
};
if (reply)
body["reply_to_message_id"] = reply;
const opts = { method: "POST", body };
const opts = {
method: "POST",
body: JSON.stringify(body),
headers: {
"Content-Type": "application/json"
}
};
return await (await fetch(`${this.api}/sendMessage`, opts)).json();
}
format(msg) {