Giter Club home page Giter Club logo

bismillahbot's Introduction

BismillahBot

بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ

BismillahBot is a bot on Telegram to explore the Holy Qur'an.

Table of Contents

Usage

Use the bot by messaging Bismillahbot on Telegram. For every verse the bot has an English translation from Imam Ahmad Raza, audio recitation by Shaykh Mahmoud Khalil al-Husary, and exegesis (tafsir) from Tafsir al-Jalalayn. The translation and tafsir are available anywhere on Telegram via inline mode, just start a text with @BismillahBot (for example, type @BismillahBot 1:1 in any chat). A conversation looks like: example

Installation

You can run your own instance of BismillahBot. First you need to request a bot username and token. You also need a Unix-like system to run the bot on. BismillahBot is running on a Debian server. The following gets the code, and installs the dependencies on Debian/Ubuntu in a virtualenv:

sudo apt install redis-server git python3-pip python3-dev virtualenv
git clone https://github.com/rahiel/BismillahBot.git
cd BismillahBot/
virtualenv -p python3 venv
. venv/bin/activate
pip install -r requirements.txt --upgrade

In the same directory you should define a secret.py with the token you got from the BotFather:

TOKEN = "<your-token-here>"

Disable group chats for the bot by sending the BotFather the /setjoingroups command and customize the bot further.

Data files

The bot serves Quranic data collected from several projects. These are necessary for the bot to function. Run the following in the bot's directory to get the data:

wget "http://tanzil.net/trans/en.ahmedraza"
wget "http://tanzil.net/res/text/metadata/quran-data.xml"
wget "http://www.altafsir.com/Books/Al_Jalalain_Eng.pdf"
pdftotext -nopgbrk Al_Jalalain_Eng.pdf
wget "http://www.everyayah.com/data/Husary_128kbps/000_versebyverse.zip"
unzip -d Husary 000_versebyverse.zip
wget "http://www.everyayah.com/data/quranpngs/000_images.zip"
unzip -d quran_images 000_images.zip

We do some post-processing on the images. First we remove the empty area's from the edges with ImageMagick and GNU parallel:

cd quran_images/
parallel "echo {}; convert {} -trim {}" ::: *.png

Then we optimize the images with pngout:

parallel "pngout {}" ::: *.png

You could use other data files, like other translations or audio recitations. These choices are currently hardcoded in the bot, so file an issue if you'd like to use different data.

If all went fine you can now run the bot with python bismillah.py.

Updating

The bot (and dependencies) can be updated by running the following in its directory:

git pull
. venv/bin/activate
pip install -r requirements.txt -U

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

bismillahbot's People

Contributors

rahiel avatar

Watchers

James Cloos avatar

Forkers

xeoncrypto

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.