GithubHelp home page GithubHelp logo

knorpelsenf / link-preview-bot Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 3.0 104 KB

Telegram bot to generate link previews for all links in messages.

Home Page: https://t.me/linkpreviewbot

License: GNU Affero General Public License v3.0

TypeScript 100.00%

link-preview-bot's Introduction

Link Preview Bot

What is this

This is a tiny Telegram bot (@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 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 installed.

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.
  2. Create a project on Deno Deploy.
  3. Upload this source code.
  4. Store the bot token in an environment variable called BOT_TOKEN.
  5. 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 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).

link-preview-bot's People

Contributors

agoudbg avatar knorpelsenf avatar spechide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.