Skip to content

Configuration

hyPnOtICDo0g edited this page Jan 22, 2022 · 6 revisions

This guide is for Ubuntu/Debian Linux distributions & WSL. Deploying the bot on other distributions may vary.

Skip this page if you're using the heroku deploy button.

Environment variables

Rename the given sample config.

mv config_sample.env config.env

Use your preferred text editor & set the env variables in config.env.

  • BOT_TOKEN: The Telegram bot token that you get from @BotFather.
  • OWNER_ID: The Telegram user ID of the Bot Owner. Can be obtained from @MissRose_bot by using the /info command.
  • CHAT_ID: The chat ID where you want your feed posts to be dumped.
  • The group ID can be obtained from @MissRose_bot by using /id command in a specific group.
  • It can be set as OWNER_ID if you want the feed posts in the bot's DM.
  • Instructions for telegram channels are here.
  • DELAY: The delay between each feed request. It is set to 600s (10 mins) by default. Set this in seconds only.
  • DATABASE_URL: Check the Database section for more info.
  • CUSTOM_MESSAGES: To display a custom message at the top of every new feed.

Database

Skip this if you're deploying to heroku using CLI.

Change the given variables below (YOUR_USER, etc.) to your preferred values.

  • Install PostgreSQL.
sudo apt-get update && sudo apt install postgresql
  • Start the postgresql service.
sudo service postgresql start
  • Switch over to the postgres user.
sudo -iu postgres
  • Create a new database user & enter a password when prompted.
createuser -P -s -e YOUR_USER
  • Create a new database table.
createdb -O YOUR_USER YOUR_DB_NAME
  • Test the database connection.

HOST: 0.0.0.0
PORT: 5432

psql YOUR_DB_NAME -h HOST -p PORT YOUR_USER

This should allow you to connect to your database via terminal. Finally, your database URI will be:

postgres://YOUR_USER:password@HOST:PORT/YOUR_DB_NAME

To secure your Database, read the debian wiki.

Clone this wiki locally