Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aldrinjenson/tg-querysearchbot
Telegram bot to make easy internet queries without leaving telegram.
https://github.com/aldrinjenson/tg-querysearchbot
aws-lambda nodejs serverless telegram-bot
Last synced: 7 days ago
JSON representation
Telegram bot to make easy internet queries without leaving telegram.
- Host: GitHub
- URL: https://github.com/aldrinjenson/tg-querysearchbot
- Owner: aldrinjenson
- Created: 2021-06-27T16:11:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-24T13:13:02.000Z (almost 3 years ago)
- Last Synced: 2023-03-03T22:02:52.521Z (over 1 year ago)
- Topics: aws-lambda, nodejs, serverless, telegram-bot
- Language: JavaScript
- Homepage: https://t.me/querySearchBot
- Size: 80.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tg-querySearchBot
### A bot for querying the internet directly from Telegram, written in nodeJS
Enter any query after a /qs for the top 3 results.
eg: /qs Software development best practicesYou can get the top 1 result using /qs1 search_term
eg: /qs1 Nikola TeslaYou can also add this bot to groups and query using the same 2 commands
To try, check out [@querySearchBot](https://t.me/querySearchBot)
### Development
- The bot runs using serverless framework in AWS Lambda with Telegram webhooks
- For setting up webooks easily, refer this [article](https://xabaras.medium.com/setting-your-telegram-bot-webhook-the-easy-way-c7577b2d6f72)
OR
- GET webhook info: https://api.telegram.org/bot{BOT_TOKEN}/getWebhookInfo
- SET Webhook: https://api.telegram.org/bot{BOT_TOKEN}/setWebhook?url={POST_url_received_after_lambda_deployment}
- Delete Webhook: https://api.telegram.org/bot{BOT_TOKEN}/deleteWebhook#### Some gotchas to keep in mind
- Serverless Lambda supports only NodeJS v12 for now. Any later features like conditional chaining in later versions of node is not currently supported.
- It is important that you return an object with statusCode 200 so that telegram understands that the query has been successfully answered.
- when you want to send JSON, ensure that you send it after stringifying it first
- For sending URLs sometime you may get the error `TypeError: Request path contains unescaped characters` which can be fixed using [this answer](https://stackoverflow.com/a/62437210/11879596)