Giter Site home page Giter Site logo

dcdunkan / bible-bot Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 5.0 57 KB

A simple Telegram Bot for reading the whole Bible in 80+ translations inside Telegram.

Home Page: https://telegram.me/scripturbot

License: MIT License

TypeScript 100.00%
grammyjs typescript telegram-bot bible getbible deta-base deta deno

bible-bot's Introduction

Bible Bot

Try official public instance of the bot here: Scripture Bot

Bible Bot, for reading the whole Bible in 80+ translations inside Telegram. You can read the bible, request a passage by sending the reference and customize your experience.

This is a complete re-write and modified version of the previous version: 3, which you can find here: dcdunkan/bible-bot-v3.

Re-written in TypeScript and grammY and now it runs on Deno.

Built Using

Thanks to these tools and libraries.

  1. GetBible.net API — A simple API used for fetching the Scripture data for the various translations.
  2. grammY - The coolest Telegram Bot Framework.
  3. Deta Space Database - Free and unlimited Cloud Database service.

Features

  • Read the whole Bible in 80+ translations (Does not require any manual updating by this bot, it should update as the GetBible API data updates). Use the /translations or /read command in chat.
  • Request a passage by sending the reference. You can find the accepted book names and formats by sending /valid_references in chat.
  • Set a default translation. You don't have to do /translations every time and choose one. You can set a default one using /default. And this will be used when using /read command and requesting passages.
  • Bookmarks. Click on the 🔖 button to bookmark a page and ❌🔖 to remove it. Use /bookmarks to list all of your bookmarks.
  • Customize your experience with the options (You can suggest something new by opening an issue or by contributing) in the /settings menu.
  • I was reading ABC last day. Ah, use /last to get back to the last read page.

I really want to add more features like, using inline to share verses, or something like a verse image generator, maybe? Maybe sometime in future.

Setup

Running Locally

Make sure you have installed Deno.

  • Clone the repository.

    git clone https://github.com/dcdunkan/bible-bot.git
  • Change directory (cd) to the cloned repository.

  • Create a .env file and set environment variables like in .env.example. Make sure you have set LOCALLY to 1.

  • Run the bot using the command below.

    DEBUG=1 deno run \
      --allow-net --allow-env --allow-read --allow-write \
      main.ts

    Or set DEBUG=grammy* to see the debug logs.

    Required permissions

    • --allow-net - To communicate with Telegram servers and receive updates.
    • --allow-env - To access environment variables.
    • --allow-read - To read cached files.
    • --allow-write - To cache files.

Deno Deploy

The working bot, @scripturbot is currently deployed on Deno Deploy (Beta 3). Even though I have implemented a fine getbible.net API call caching system, it's not being used since Deno Deploy currently does not provide file system writing access. If you're deploying to Heroku or some other, you should be able to enable caching by providing a USE_CACHE=1 in environment variables.

Click the button to deploy to Deno Deploy.

Deploy to Deno Deploy

Or click here

After deploying you will get a link to your application, in the format https://<appname>.deno.dev/.

Open browser and go to the link down below.

  • Replace the <BOT_TOKEN> with your BOT_TOKEN.
  • Replace <APP_URL> with the link to your application.

https://api.telegram.org/bot<BOT_TOKEN>/setWebhook?url=<APP_URL>

This will set the bot's webhook to the deployed application, so it will be able to handle updates.

Environment Variables

Variable Required? Description
BOT_TOKEN Yes. The API token of the Bot. Chat with https://t.me/BotFather to get one.
DETA_KEY Yes. Project Key of Deta.sh Project. Sign up and create a project at https://deta.sh.
USE_CACHE No. Set the value to 1 if you want caching to work.

License

This application is licensed under the MIT License. See the LICENSE file for more information on copying and distributing this piece of software.

Contributing

Contributions are very welcomed here! Want to suggest a feature or report an issue? Feel free to open issues and pull requests if you're working on it.


In loving memory of my friend Shamil.

Made with just <3

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.