Skip to content

Multifunctional and easily modifiable free Telegram bot which allows you to easily organize technical support for your project/business in Telegram.

License

Notifications You must be signed in to change notification settings

Kamilfo-Developer/telegram-support-bot

Repository files navigation

telegram-support-bot

Other languages: русский, english

A telegram bot made in Python that will allow you to quickly deploy a convenient, multifunctional and extensible way to organize technical support for your product via Telegram.

Deploy

Ways:

  1. Deploy using Docker (This way is recommended in case you are not going to change the source code)
  2. Deploy using the source code

Deploy using Docker


Requirements: Docker (Installation: Windows, Linux), Git

First, let's clone this repo using next command:

git clone https://github.com/Kamilfo-Developer/telegram-support-bot.git

Then go to the repo root directory:

cd telegram-support-bot

Now we are ready to create .env file which will be a config for the app. After it's done, we need to open it using a text editor. For example, nano for Linux or Notepad for Windows.

Since it's done, we have to set bot's configuration. If you launch the app via docker-compose (it's recommended if no additional options needed), simply add to the .env file next lines:

BOT_TOKEN=<Your bot's token>
OWNER_PASSWORD=<Password for the owner initialization>

If you are curious about some of these fields, you can figure out their purpose here.

Next, you are going to need Docker. When it's installed, enter next command to the terminal:

docker-compose up -d

If you've done everything right, the bot will be ready to use. Congratulations!

Deploy using the source code


Requirements: Python of version 3.10 or greater, Git

First, let's clone the repo:

git clone https://github.com/Kamilfo-Developer/telegram-support-bot.git

Then go to the repo root directory:

cd telegram-support-bot

Now we have to install poetry:

  • Windows: pip install poetry
  • Linux: pip3 install poetry

That far, we are ready to install all the dependencies using poetry (the installation speed can vary depending on your device's internet connection quality):

poetry install

Let's activate the environment with the collected dependencies:

poetry shell

Now we are ready to create .env file which will be a config for the app. After it's done, we need to open it using a text editor. For example, nano for Linux or Notepad for Windows.

Since it's done, we have to set bot's configuration. If you are fine with SQLite as the Database, it's enough to add next lines to the .env file:

BOT_TOKEN=<Your bot's token>
OWNER_PASSWORD=<Password for the owner initialization>

If you are curious about some of these fields, you can figure out their purpose here.

After completing the app's configuration, you have to apply migrations for the database using Alembic. To do so, enter next commands:

First, go to the migrations directory:

cd bot/db/migrations

Then apply the migrations:

alembic upgrade head

Finally, get back to the repo's root directory.

cd ../../..

If the migrations were applied successfully, you are ready to start the bot. Just use next command:

python -m bot

If you've done everything right, the bot will be ready to use. Congratulations!

Configuration description


Basic configuration


BOT_TOKEN

Used for passing the token to the bot. The token can be obtained here: https://telegram.me/BotFather.

Default value: no default value

OWNER_PASSWORD

Password to for the owner initializing precess. Should be a single world. For example, MyReallyReliablePassword. After starting the bot, you will need to enter /initowner command with the password as first argument. Eventually, you will have next string: /initowner MyReallyReliablePassword. After sending this comnad, the bot will be ready to use.

Default value: no default value

OWNER_DEFAULT_DESCRIPTIVE_NAME

Default owner's name. Must be a single word. For example, OwnerOfThisBot.

Default value: Owner

DEFAULT_LANGUAGE_CODE

Sets the default language. Will be used if user's language can't be found among the available languages. The string must be a IETF-tag. For example, ru or en.

Default value: en.

DB_PROVIDER

Sets the database, which will be used as bot's storage. Accepts next values: sqlite, postgres, mysql

Default value: sqlite

docker-compose default value: postgres

TIMEZONE

Timezone which will be used for formating date and time for users' messages. Example: America/New_York. Full list of timezones in this format can be found here.

Default value: will be used local timezone


PostgreSQL configuration


POSTGRES_DRIVER_NAME

A name of corresponding asynchronous SQLAlchemy supported driver for PostgreSQL.

Keep in mind that for using not default driver, it must be installed first.

Default value: asyncpg

POSTGRES_DB_NAME

The name of database inside PostgreSQL.

Default value: postgres

POSTGRES_USERNAME

The username inside PostgreSQL.

Default value: postgres

POSTGRES_HOST

PostgreSQL database host.

Default value: localhost

docker-compose default value: db

POSTGRES_PORT

PostgreSQL host's port.

Default value: 5432

POSTGRES_PASSWORD

PostgreSQL user's password.

Default value: postgres

MySQL configuration

MYSQL_DRIVER_NAME

A name of corresponding asynchronous SQLAlchemy supported driver for MySQL.

Keep in mind that for using not default driver, it must be installed first.

Default value: asyncmy

MYSQL_DB_NAME

The name of database inside PostgreSQL. Must be set if you are using this database.

Default value: no default value

MYSQL_USERNAME

The username inside MySQL. Must be set if you are using this database.

Default value: no default value

MYSQL_HOST

MySQL database host.

Default value: localhost

MYSQL_PORT

MYSQL host's port.

Default value: 3306

MYSQL_PASSWORD

MySQL user's password. Must be set if you are using this database.

Default value: no default value

About

Multifunctional and easily modifiable free Telegram bot which allows you to easily organize technical support for your project/business in Telegram.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages