Skip to content

Latest commit

 

History

History
155 lines (124 loc) · 4.62 KB

README.md

File metadata and controls

155 lines (124 loc) · 4.62 KB

bot_template

My template for aiogram bots

bot_template logo
language issues GitHub closed issues GitHub pull requests GitHub closed pull requests GitHub Repo stars wakatime

🌟Hello everyone! This is the template for developing Telegram bots on Python with aiogram.🌟

Motivation ❗

When I was developing Telegramia, I've used these templates: aiogram-bot-template and tgbot_template for creating bots. And I have many probles with them. So I decided to create my own template.

Diagram

Here you can understand how template works and what is imported from where.

classDiagram
    bot <|-- loader: dp
    bot <|-- aiogram: executor
    bot <|-- `tgbot.handlers`
    bot <|-- `tgbot.filters`: custom_filter
    bot <|-- `tgbot.middlewares` : custom_middleware
    bot <|-- `tgbot.services` : set_commands(), on_startup_notify()
    bot <|-- `tgbot.config` : load_config()
    `tgbot.handlers` <|-- some_handler
    `tgbot.handlers` <|-- `tgbot.keyboards`: reply_keyboard, inline_keyboard
    `tgbot.handlers` <|-- `tgbot.middlewares` : rate_limit()
    `tgbot.handlers` <|-- `tgbot.states` : custom_state
    some_handler <|-- loader: dp
    loader <|-- `tgbot.config` : load_config()
    `tgbot.keyboards` <|-- reply
    `tgbot.keyboards` <|-- inline
    `tgbot.middlewares` <|-- custom_middleware
    `tgbot.services` <|-- set_default_commands
    `tgbot.services` <|-- admins_notify
    class bot{
      Logger logger
      executor
      register_all_middlewares(dispatcher: Dispatcher)
      register_all_filters(dispatcher: Dispatcher)
      register_all_handlers(dispatcher: Dispatcher)
      register_all_commands(dispatcher: Dispatcher)
      on_startup(dispatcher: Dispatcher)
      on_shutdown(dispatcher: Dispatcher)
      executor.start_polling()
    }
    class aiogram{
        executor
    }
    class loader{
      Config config
      Bot bot
      Dispatcher dp
      MemoryStorage storage
    }
    class `tgbot.config`{
      load_config()
    }
    class `tgbot.handlers`{
    }
    class some_handler{

    }
    class `tgbot.filters`{
      custom_filter
    }
    class `tgbot.keyboards`{

    }
    class reply {
        reply_keyboard
    }
    class inline {
        inline_keyboard
    }
    class `tgbot.middlewares` {

    }
    class custom_middleware {
        rate_limit()
    }
    class `tgbot.misc` {

    }
    class `tgbot.models` {

    }
    class `tgbot.services` {

    }
    class set_default_commands {
        set_commands()
    }
    class admins_notify {
        on_startup_notify()
    }
    class `tgbot.states` {
        custom_state
    }
Loading

Examples

Installation 💻

  1. Clone the repository
git clone https://github.com/mezgoodle/bot_template.git
  1. Install dependencies
pip install -r requirements.txt

Fast usage 💨

  1. Set the bot token in the tgbot.config.py file

  2. Run the bot

python bot.py

Contribute 🏃

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Credits 🐱🤝

License 🔖

MIT © mezgoodle