Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KnorpelSenf/link-preview-bot
Telegram bot to generate link previews for all links in messages.
https://github.com/KnorpelSenf/link-preview-bot
Last synced: 2 months ago
JSON representation
Telegram bot to generate link previews for all links in messages.
- Host: GitHub
- URL: https://github.com/KnorpelSenf/link-preview-bot
- Owner: KnorpelSenf
- License: agpl-3.0
- Created: 2019-07-31T10:12:49.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-13T18:21:57.000Z (9 months ago)
- Last Synced: 2024-10-30T08:05:15.274Z (3 months ago)
- Language: TypeScript
- Homepage: https://t.me/linkpreviewbot
- Size: 102 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-grammY - KnorpelSenf/link-preview-bot - Generate link previews for all links in messages. [ᴜsᴇ](https://t.me/linkpreviewbot) (Bots)
README
# Link Preview Bot
## What is this
This is a tiny Telegram bot ([@linkpreviewbot](https://t.me/linkpreviewbot))
written in TypeScript that sends all links back to you that were found in your
(think: forwarded) message. It can also follow redirects to resolve shortened
links. The bot is useful if you want to (see the link preview or) visit the
instant view page but the original sender disabled the preview. This happens
often when subscribing to newsletter bots. So now you can subscribe to a news
bot that does not send instant view pages and forward all interesting messages
to [@linkpreviewbot](https://t.me/linkpreviewbot) to read them with instant view
anyway.Note that instant view pages may circumvent paywalls in some cases, e.g. when
the reader is permitted to read only a limited number of articles per
day/week/month. Consider buying a subscription from your favorite news page if
you feel guilty.It can also generate messages with link previews for hidden links. This works
because Telegram supports sending messages with link previews to websites that
are not contained in the message text. Check out the `/generate URL` command.## How do I run it locally
Make sure you have [Deno](https://deno.land/) installed.
```bash
git clone [email protected]:KnorpelSenf/link-preview-bot.git
export BOT_TOKEN=your-bot-token
export DEBUG='*' # this will switch to polling+debug logs
deno run --allow-net --allow-env bot.ts
```## How do I deploy it on Deno Deploy
1. Make sure you have a bot token from [@BotFather](https://t.me/botfather).
1. Create a project on [Deno Deploy](https://deno.com/deploy).
1. Upload this source code.
1. Store the bot token in an environment variable called `BOT_TOKEN`.
1. Remember to set the webhook at api.telegram.org to your deployment's URL.## I don't understand X and Y isn't working either
Sorry, I hacked the first version of this in under 24 hours and I no longer
bother to work on this. The bot simply does its job, it's convenient, versatile,
stable and even highly scalable due to its Cloud Function nature. Contact me on
[Telegram](https://t.me/KnorpelSenf) if there is something about the project
that you just cannot figure out on your own. I know that there could be better
docs (as always).