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 => {
|
.catch(err => {
|
||||||
|
this.emit("error", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
send(chatid, msg, reply = null) {
|
send(chatid, msg, reply = null) {
|
||||||
|
@ -88,6 +89,7 @@ export class tg extends EventEmitter {
|
||||||
fetch(`${this.api}/sendMessage`, opts)
|
fetch(`${this.api}/sendMessage`, opts)
|
||||||
.then(res => {})
|
.then(res => {})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
this.emit("error", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
sendmsg(mode, recipient, msg) {
|
sendmsg(mode, recipient, msg) {
|
||||||
|
@ -100,16 +102,10 @@ export class tg extends EventEmitter {
|
||||||
channel: tmp.chat.title,
|
channel: tmp.chat.title,
|
||||||
channelid: tmp.chat.id,
|
channelid: tmp.chat.id,
|
||||||
user: {
|
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}`,
|
prefix: `${tmp.from.username}!${tmp.from.id}`,
|
||||||
nick: tmp.from.first_name,
|
nick: tmp.from.first_name,
|
||||||
username: tmp.from.username,
|
username: tmp.from.username,
|
||||||
account: tmp.from.id.toString()
|
account: tmp.from.id.toString()
|
||||||
})
|
|
||||||
},
|
},
|
||||||
self: this.server,
|
self: this.server,
|
||||||
message: tmp.text,
|
message: tmp.text,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user