Giter VIP home page Giter VIP logo

aiogram-template's Introduction

โšก Aiogram bot template

It is a template you can use for creating telegram bot with aiogram 3. It supports internationalization

Tools:

  • ๐Ÿ’ช Aiogram (v3)
  • ๐Ÿ˜„ i18n
  • ๐Ÿคน๐Ÿฝ Loguru

๐Ÿ”ฅ Getting started

Requirements:

  • Python
  • Make

Installing

For linux
git clone [email protected]:lleballex/aiogram-template.git
cd aiogram-template
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt
For windows
git clone [email protected]:lleballex/aiogram-template.git
cd aiogram-template
python -m venv env
env\scripts\activate
pip install -r requirements.txt

Starting

python src/bot.py

โœ Adding handlers

Just create new file in src/handlers folder or its subfolder

Initialize router and use it to handle events:

from aiogram import Router
my_router = Router()

Add created router to router list in src/handlers/__init__.py:

from .my_file import my_router
routers = [my_router]

๐Ÿ“– Internationalization

This template uses i18n. So wrap your messages in aiogram.utils.i18n.gettext to make it translatable
More information you can find here

Extracting messages (creating .pot):

make i18n-extract

Initializing a new language:

mkdir locales
pybabel init -i locales/messages.pot -d locales -D messages -l en

Compiling translations (.po -> .mo):

make i18n-compile

Updating translated messages (.po) with new extracted messages (.pot):

make i18n-update

๐Ÿ™‹๐Ÿฝโ€โ™‚๏ธ Contact me

aiogram-template's People

Contributors

lleballex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

totoro2205

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.