fig telegram client
also add error handling
This commit is contained in:
parent
ea212a5ad0
commit
d8655e4d87
|
@ -70,6 +70,7 @@ export class tg extends EventEmitter {
|
|||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.emit("error", err);
|
||||
});
|
||||
}
|
||||
send(chatid, msg, reply = null) {
|
||||
|
@ -88,6 +89,7 @@ export class tg extends EventEmitter {
|
|||
fetch(`${this.api}/sendMessage`, opts)
|
||||
.then(res => {})
|
||||
.catch(err => {
|
||||
this.emit("error", err);
|
||||
});
|
||||
}
|
||||
sendmsg(mode, recipient, msg) {
|
||||
|
@ -100,16 +102,10 @@ export class tg extends EventEmitter {
|
|||
channel: tmp.chat.title,
|
||||
channelid: tmp.chat.id,
|
||||
user: {
|
||||
prefix: `${tmp.from.username}!${tmp.from.id}`,
|
||||
nick: tmp.from.first_name,
|
||||
username: tmp.from.username,
|
||||
account: tmp.from.id.toString(),
|
||||
level: getLevel("Telegram", {
|
||||
prefix: `${tmp.from.username}!${tmp.from.id}`,
|
||||
nick: tmp.from.first_name,
|
||||
username: tmp.from.username,
|
||||
account: tmp.from.id.toString()
|
||||
})
|
||||
},
|
||||
self: this.server,
|
||||
message: tmp.text,
|
||||
|
|
Loading…
Reference in New Issue
Block a user