diff --git a/components/telegram_bot_api/package.json b/components/telegram_bot_api/package.json index d4469455c6c9b..4f6299a6deca6 100644 --- a/components/telegram_bot_api/package.json +++ b/components/telegram_bot_api/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/telegram_bot_api", - "version": "0.3.11", + "version": "0.3.12", "description": "Pipedream Telegram_bot_api Components", "main": "telegram_bot_api.app.mjs", "keywords": [ @@ -10,7 +10,7 @@ "homepage": "https://pipedream.com/apps/telegram_bot_api", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@pipedream/platform": "^0.9.0", + "@pipedream/platform": "^3.0.3", "node-telegram-bot-api": "^0.54.0", "uuid": "^8.3.2" }, diff --git a/components/telegram_bot_api/sources/message-updates/message-updates.mjs b/components/telegram_bot_api/sources/message-updates/message-updates.mjs index 2f34646285987..0212549c5d55b 100644 --- a/components/telegram_bot_api/sources/message-updates/message-updates.mjs +++ b/components/telegram_bot_api/sources/message-updates/message-updates.mjs @@ -6,11 +6,37 @@ export default { key: "telegram_bot_api-message-updates", name: "New Message Updates (Instant)", description: "Emit new event each time a Telegram message is created or updated.", - version: "0.1.5", + version: "0.1.6", type: "source", dedupe: "unique", + props: { + ...base.props, + chatId: { + propDefinition: [ + base.props.telegramBotApi, + "chatId", + ], + optional: true, + }, + }, + hooks: { + ...base.hooks, + async deploy() { + if (this.chatId) { + const { id } = await this.telegramBotApi.sdk().getChat(this.chatId); + this._setChatId(id); + } + await base.hooks.deploy.call(this); + }, + }, methods: { ...base.methods, + _getChatId() { + return this.db.get("chatId"); + }, + _setChatId(chatId) { + this.db.set("chatId", chatId); + }, getMeta(event, message) { return { id: event.update_id, @@ -26,6 +52,12 @@ export default { }, processEvent(event) { const message = event.edited_message ?? event.message; + if (this.chatId) { + const chatId = this._getChatId(); + if (chatId && chatId != message?.chat?.id) { + return; + } + } this.$emit(event, this.getMeta(event, message)); }, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a75bef9d30c07..64245aa384778 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -883,8 +883,7 @@ importers: specifier: ^1.1.1 version: 1.6.6 - components/apiverve: - specifiers: {} + components/apiverve: {} components/apollo_io: dependencies: @@ -7473,8 +7472,7 @@ importers: specifier: ^1.6.0 version: 1.6.6 - components/lucca: - specifiers: {} + components/lucca: {} components/lucid: dependencies: @@ -9296,8 +9294,7 @@ importers: specifier: ^2.0.0 version: 2.0.0 - components/pdf4me: - specifiers: {} + components/pdf4me: {} components/pdf_api_io: {} @@ -10066,8 +10063,7 @@ importers: components/proprofs_quiz_maker: {} - components/provesource: - specifiers: {} + components/provesource: {} components/proworkflow: dependencies: @@ -12758,8 +12754,8 @@ importers: components/telegram_bot_api: dependencies: '@pipedream/platform': - specifier: ^0.9.0 - version: 0.9.0 + specifier: ^3.0.3 + version: 3.0.3 node-telegram-bot-api: specifier: ^0.54.0 version: 0.54.0 @@ -14364,8 +14360,7 @@ importers: specifier: ^0.1.4 version: 0.1.6 - components/yepcode: - specifiers: {} + components/yepcode: {} components/yespo: dependencies: @@ -34436,6 +34431,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: