Do not reply to a bot account
This commit is contained in:
6
index.ts
6
index.ts
@@ -178,7 +178,7 @@ function initializeStream() {
|
|||||||
initializeStream();
|
initializeStream();
|
||||||
});
|
});
|
||||||
channel.on("mention", async (e) => {
|
channel.on("mention", async (e) => {
|
||||||
if (e.text && e.userId !== me.id) {
|
if (e.text && e.userId !== me.id && !e.user.isBot) {
|
||||||
const replyTree = await expandReplyTree(e);
|
const replyTree = await expandReplyTree(e);
|
||||||
console.log(`* push: reply (${e.id}, ${replyTree.length} msgs)`);
|
console.log(`* push: reply (${e.id}, ${replyTree.length} msgs)`);
|
||||||
jobs.push({ type: "reply", id: e.id, replyTree });
|
jobs.push({ type: "reply", id: e.id, replyTree });
|
||||||
@@ -200,8 +200,12 @@ async function runJob() {
|
|||||||
const job = jobs.pop();
|
const job = jobs.pop();
|
||||||
if (job) {
|
if (job) {
|
||||||
console.log(`* pop: ${job.type}`);
|
console.log(`* pop: ${job.type}`);
|
||||||
|
try {
|
||||||
await processJob(job);
|
await processJob(job);
|
||||||
console.log("* job complete");
|
console.log("* job complete");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`* error: ${e}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await sleep(1000); // 1sec
|
await sleep(1000); // 1sec
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user