Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram Bot - New Message Updates (Instant) - Add optional Chat ID prop #16071

Merged
merged 6 commits into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/telegram_bot_api/package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> (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"
},
Original file line number Diff line number Diff line change
@@ -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));
},
},
21 changes: 9 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.