Inline-directory-bot [Telegram]

Inline-directory-bot [Telegram]

Renjith

๐€ ๐ฌ๐ข๐ฆ๐ฉ๐ฅ๐žย ๐ˆ๐ง๐ฅ๐ข๐ง๐ž ๐“๐ž๐ฅ๐ž๐ ๐ซ๐š๐ฆ ๐๐จ๐ญ ๐œ๐š๐ง ๐ฌ๐ž๐ซ๐ฏ๐ž ๐ž๐ฆ๐ฉ๐ฅ๐จ๐ฒ๐ž๐ž ๐๐ž๐ญ๐š๐ข๐ฅ๐ฌ ๐ข๐ง ๐š ๐œ๐ฅ๐จ๐ฌ๐ž๐ ๐œ๐ข๐ซ๐œ๐ฅ๐ž ๐ฐ๐ข๐ญ๐ก ๐ฅ๐จ๐ญ๐ฌ ๐จ๐Ÿ ๐Ÿ๐ž๐š๐ญ๐ฎ๐ซ๐ž๐ฌ.

This bot is specially made for those who are working in a large size institution having an official group/channel in Telegram.


๐Ÿ•น Working:

The bot needs a group/channel in which the members of the same can only get the inline search results.


๐Ÿ•น Mandatory Things:

๐Ÿ‘‰ Need a Telegram Group / Channel to perform. The bot needs to be an admin.

๐Ÿ‘‰ The bot needs to be in inline mode.

๐Ÿ‘‰ Need ADMIN USERS to do special functions.

๐Ÿ‘‰ Need SUDO USERS to broadcast messages to bot subscribers.


๐Ÿ•น Bot Commands: [Admin Only]

start - Check alive 
add - Add contact to database (Admin only)
load - Load data from CSV (Admin only)
send - Broadcast message to bot subs(Sudo Only)
users - List users of the bot (Sudo Only)
photo - Update thumbnail photo (Admin only)
delete - Mass delete contacts (Admin only)
email - Update E-Mail address (user)
admins - View Admin user of the bot (user)
mobile- Update mobile number (user)
extension - Update extension umber (user)


๐Ÿ•น Mandatory Variables:

TG_BOT_TOKEN    - Get from @BotFather


APP_ID          - Get from my.telegram.org


API_HASH        - Get from my.telegram.org


DB_URI = os.environ.get("DATABASE_URL", "")

For Heroku, just leave the DB_URI field as the above. In VPS /Linux servers, See the bottom section to create a database.


DEFAULT_CHAT_ROOM = int(-100xxxxxxxxxxxxxx)

Group / Channel Id of the chat circle which bot serves the result as a pm to the members.


ADMIN_USERS = [xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx]

Admin user ids separated by <space>


SUDo_USERS = [xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx]

Sudo user ids separated by <space>


๐Ÿ•น In Linux servers or VPS: Please follow the steps:

[To create a database URI:]

This bot needs a database. So, you'll need to have a database installed on your system. I personally use Postgres, so I recommend using it for optimal compatibility.

In the case of Postgres, this is how you would set up a database on a Debian/Ubuntu system. Other distributions may vary.


  1. Open terminal as superuser
sudo su


2. Install PostgreSQL database:

sudo apt-get update && sudo apt-get install postgresql


3. Change to the Postgres user:

sudo su - postgres


4. Create a new database user :

(change YOUR_USER appropriately)

createuser -P -s -e YOUR_USER_NAME


5. This will be followed by you need to input your password.


6. Create a new database table:

createdb -O YOUR_USER YOUR_DB_NAME


7. Create the database with your own values :

Change YOUR_USER and YOUR_DB_NAME appropriately.

psql YOUR_DB_NAME -h YOUR_HOST YOUR_USER


This will allow you to connect to your database via your terminal. By default, YOUR_HOST should be localhost:5432


You should now be able to build your database URI. This will be:

sqldbtype://username:pw@hostname:port/db_name


8. An example database URI could be like:

postgresql://johnson:1234@localhost:5432/clonebotdb


Replace sqldb type with whichever dB you're using (eg postgresql, mysql, sqllite, etc) repeat for your username, password, hostname (localhost?), port (5432?), and db name.


9. Createย config.pyย  in the main directory:

With mandatory variables andย database URI create a config.py


Open the main bot directory > right-click > open a terminal here >

Or

Open a terminal > change to the bot main directory by cd /xxx/xxx


10. Finally, Run the following in the Terminal:

virtualenv -p python3 venv
. ./venv/bin/activate
pip3 install -r requirements.txt
python3 bot.py


๐Ÿ•น Configuration Procedure: TO KNOW THE COMMAND USAGE CLICK HERE


  1. LICENCE
  2. CREDITS
  3. DEVELOPER



Report Page