-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Makefile for convenience
- Loading branch information
Showing
8 changed files
with
678 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
PROJECT_DIR=aiogram_bot_template | ||
|
||
all: lint | ||
|
||
lint: | ||
poetry run python -m ruff $(PROJECT_DIR) --config pyproject.toml --fix | ||
poetry run python -m isort $(PROJECT_DIR) | ||
poetry run python -m mypy $(PROJECT_DIR) --config-file pyproject.toml | ||
poetry run python -m black $(PROJECT_DIR) --config pyproject.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .chat_type import ChatTypeFilter as ChatTypeFilter | ||
from .text import TextFilter as TextFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from aiogram.filters import BaseFilter | ||
from aiogram.types import CallbackQuery, Message | ||
|
||
|
||
class TextFilter(BaseFilter): | ||
def __init__(self, text: str | list[str]): | ||
if isinstance(text, str): | ||
self.text = [text] | ||
else: | ||
self.text = text | ||
|
||
async def __call__(self, obj: Message | CallbackQuery) -> bool: | ||
if isinstance(obj, Message): | ||
txt = obj.text or obj.caption | ||
return any(i == txt for i in self.text) | ||
elif isinstance(obj, CallbackQuery): | ||
return obj.data in self.text | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ ignore-init-module-imports = true | |
|
||
[tool.poetry] | ||
name = "aiogram-bot-template" | ||
version = "2.1.0" | ||
version = "2.2.0" | ||
description = "Template for creating scalable bots with aiogram" | ||
authors = ["Forden <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -58,14 +58,14 @@ aiogram_bot_template = "aiogram_bot_template.bot:main" | |
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
environs = "^9.5.0" | ||
aiohttp = "^3.8.4" | ||
aiojobs = "^1.1.0" | ||
aiogram = "3.0.0b7" | ||
asyncpg = "^0.27.0" | ||
redis = "^4.5.5" | ||
orjson = "^3.9.0" | ||
aiohttp = "3.8.5" | ||
aiojobs = "1.2.0" | ||
aiogram = "3.0.0" | ||
asyncpg = "0.28.0" | ||
redis = "5.0.0" | ||
orjson = "3.9.7" | ||
structlog = "^23.1.0" | ||
tenacity = "^8.2.2" | ||
tenacity = "8.2.3" | ||
|
||
[tool.poetry.group.dev] | ||
optional = true | ||
|
@@ -75,6 +75,7 @@ mypy = "^1.3.0" | |
black = { extras = ["d"], version = "^23.3.0" } | ||
ruff = "^0.0.267" | ||
types-redis = "^4.5.5.2" | ||
isort= "5.12.0" | ||
|
||
|
||
|
||
|