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