From 99deef3f586b89f6c7dd047039c937923d70851d Mon Sep 17 00:00:00 2001 From: Behzad Rabiei <53224485+Behzad-rabiei@users.noreply.github.com> Date: Sat, 16 Sep 2023 12:45:03 +0400 Subject: [PATCH] [FEATURE]: add isGeneratedByWebhook to rawInfo docs --- package-lock.json | 8 ++++---- package.json | 2 +- src/functions/fetchMessages.ts | 22 ++++++++++++---------- src/index.ts | 4 ++-- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0e35ac0..dd9cf3a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@sentry/node": "^7.51.2", - "@togethercrew.dev/db": "^2.4.96", + "@togethercrew.dev/db": "^2.5.0", "@togethercrew.dev/tc-messagebroker": "^0.0.40", "babel-jest": "^29.5.0", "bullmq": "^3.14.0", @@ -2948,9 +2948,9 @@ } }, "node_modules/@togethercrew.dev/db": { - "version": "2.4.96", - "resolved": "https://registry.npmjs.org/@togethercrew.dev/db/-/db-2.4.96.tgz", - "integrity": "sha512-DgM7H+IFXB1eZEXtBV1RZGMMZ7Ydgn4j8HgVstj+4YtQqbWKavNWFQsH0I4dkIreQFRvS106Erx0L9EKiyz7wg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@togethercrew.dev/db/-/db-2.5.0.tgz", + "integrity": "sha512-4sqFjm+rHKYV33DmBEmyDbhiKihe87LC73tIJAiFpgjOXgDBHhzNsSTdfOjkkbDMm85eJXcRU2MNZQWvZ9ZtGg==", "dependencies": { "discord.js": "^14.7.1", "joi": "^17.7.0", diff --git a/package.json b/package.json index 034b3959..938970bf 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "homepage": "https://github.com/Behzad-rabiei/tc-discordBot#readme", "dependencies": { "@sentry/node": "^7.51.2", - "@togethercrew.dev/db": "^2.4.96", + "@togethercrew.dev/db": "^2.5.0", "@togethercrew.dev/tc-messagebroker": "^0.0.40", "babel-jest": "^29.5.0", "bullmq": "^3.14.0", diff --git a/src/functions/fetchMessages.ts b/src/functions/fetchMessages.ts index 3f903d6e..d3e3fb5b 100644 --- a/src/functions/fetchMessages.ts +++ b/src/functions/fetchMessages.ts @@ -66,6 +66,7 @@ async function getNeedDataFromMessage(message: Message, threadInfo?: threadInfo) channelName: threadInfo?.channelName ? threadInfo?.channelName : '', threadId: threadInfo?.threadId ? threadInfo?.threadId : null, threadName: threadInfo?.threadName ? threadInfo?.threadName : null, + isGeneratedByWebhook: message.webhookId ? true : false }; } else { return { @@ -82,6 +83,7 @@ async function getNeedDataFromMessage(message: Message, threadInfo?: threadInfo) channelName: message.channel instanceof TextChannel ? message.channel.name : null, threadId: null, threadName: null, + isGeneratedByWebhook: message.webhookId ? true : false }; } } @@ -150,22 +152,22 @@ async function fetchMessages( } channel instanceof ThreadChannel ? await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()], { - threadId: channel.id, - threadName: channel.name, - channelId: channel.parent?.id, - channelName: channel.parent?.name, - }) + threadId: channel.id, + threadName: channel.name, + channelId: channel.parent?.id, + channelName: channel.parent?.name, + }) : await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()]); break; } channel instanceof ThreadChannel ? await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()], { - threadId: channel.id, - threadName: channel.name, - channelId: channel.parent?.id, - channelName: channel.parent?.name, - }) + threadId: channel.id, + threadName: channel.name, + channelId: channel.parent?.id, + channelName: channel.parent?.name, + }) : await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()]); options[fetchDirection] = boundaryMessage.id; fetchedMessages = await channel.messages.fetch(options); diff --git a/src/index.ts b/src/index.ts index 8b2e6c1b..c00d366b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -174,8 +174,8 @@ async function app() { }); queue.add('cronJob', {}, { repeat: { - cron: '0 0 * * *', // Run once 00:00 UTC - // cron: '* * * * *', // Run every minute + // cron: '0 0 * * *', // Run once 00:00 UTC + cron: '* * * * *', // Run every minute // every: 10000 }, jobId: 'cronJob', // Optional: Provide a unique ID for the job