Aiogram 3i18nRedisPeeweePostgreSQL \ Sqlite
First, clone the repository and navigate to its directory:
git clone https://github.com/devvsima/aiogram-peewee-template.git
cd tgbotInstall dependencies and activate the virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txtSimilar steps for Windows:
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt💡 Note: The name
.venvcan be changed to anything else you wish.
First, copy the .env.dist file and rename it to .env:
cp .env.dist .envThen edit the environment variables file:
vim .env
# or
nano .envAdd admin IDs, separating them with commas
# example
ADMINS=12345678,12345677,12345676TOKEN - Bot token from @BotFather
Add your bot token:
# example
BOT_TOKEN=123452345243:AsdfasdfasfSet the database connection parameters:
DB_NAME- database nameDB_HOST- database host (default = 'localhost')DB_PORT- database port (default =5432)DB_USER- database userDB_PASS- database password
Redis is used for caching and storing session data. Set up the Redis connection parameters in the .env file:
REDIS_HOST- Redis server host (default:localhost)REDIS_PORT- Redis server port (default:6379)REDIS_DB- Redis database index (default:5)REDIS_URL- Redis connection URL (optional)
Example:
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=5Ensure that Redis is installed and running before launching the bot. You can start Redis with:
redis-serverNow the bot is ready to run! 🎉