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

Update the Telegram adapter to add a rich message option with a photo #106

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ivanovvladi
Copy link
Contributor

@ivanovvladi ivanovvladi commented Aug 11, 2024

That PR updates the Telegram adapter and adds a rich message option with a photo.

It also updates a predefined example.

Plain message Rich message

Note: the PR adds image parsing for immobilienscout24, kleinanzeigen, 1a-immobilienmarkt.

@ivanovvladi ivanovvladi force-pushed the update-telegram-provider branch 2 times, most recently from 8dfbdf7 to 2244eaa Compare August 11, 2024 18:17
@ivanovvladi
Copy link
Contributor Author

Hi @orangecoding, could you review the PR? Thanks!

}

const sendTelegramMessage = (token, chatId, message, isPhoto = false, photoUrl = '') => {
const url = isPhoto
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think a simple if/else would be easier to read here..
  2. The api endpoint /sendPhoto works like /sendMessage, but it can inlcude a photo url?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, @orangecoding; I replaced the ternary operator. As for the API calls, there are some differences, but for the scope of this project, you're absolutely right - they work identically with only photo URL disparity

@@ -25,6 +25,7 @@ const config = {
link: '.aditem-main .text-module-begin a@href | removeNewline | trim',
description: '.aditem-main p:not(.text-module-end) | removeNewline | trim',
address: '.aditem-main--top--left | trim | removeNewline',
image: '.aditem-image .imagebox img@src',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding this for the other providers as well, at least where it is available?

@orangecoding
Copy link
Owner

@ivanovvladi Thanks mate, I have added 2 comments. Sorry it took a while..

@orangecoding
Copy link
Owner

@ivanovvladi have you read my second comment about adding the photo to all provider?

@ivanovvladi
Copy link
Contributor Author

@ivanovvladi have you read my second comment about adding the photo to all provider?

Hi, @orangecoding; thanks for the heads-up; I missed the comment. I will update leftover providers as soon as I get time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants