-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Economics system improvements
- Loading branch information
Showing
42 changed files
with
612 additions
and
67 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
[tool.poetry] | ||
name = "duck-duck-bot" | ||
version = "1.8.0" | ||
version = "1.9.0" | ||
description = "" | ||
authors = ["Eldos <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{ include = "telegram_bot_template" }] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
aiogram = "^3.0.0" | ||
aiogram = "^3.1.0" | ||
redis = "^5.0.0" | ||
pydantic = "^2.1.1" | ||
sentry-sdk = "^1.29.2" | ||
|
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
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,3 +1,5 @@ | ||
from .bot import * | ||
from .secret_messages import * | ||
from .text import * | ||
from .themes import * | ||
from .transfers import * |
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,10 @@ | ||
from aiogram.types import Message, User | ||
|
||
__all__ = ('reply_message_from_bot_filter',) | ||
|
||
|
||
async def reply_message_from_bot_filter( | ||
message: Message, | ||
bot_user: User, | ||
) -> bool: | ||
return message.reply_to_message.from_user.id == bot_user.id |
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,11 @@ | ||
from aiogram.types import Message | ||
|
||
__all__ = ('integer_filter',) | ||
|
||
|
||
def integer_filter(message: Message) -> bool | dict: | ||
"""Filter that checks if message text is integer.""" | ||
try: | ||
return {'number': int(message.text)} | ||
except ValueError: | ||
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
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,29 @@ | ||
from aiogram import Router, F | ||
from aiogram.filters import StateFilter, Command | ||
from aiogram.types import CallbackQuery, Message | ||
|
||
from repositories import BalanceRepository | ||
from views import UserBalanceView, render_message_or_callback_query | ||
|
||
router = Router(name=__name__) | ||
|
||
|
||
@router.message( | ||
Command('balance'), | ||
StateFilter('*'), | ||
) | ||
@router.callback_query( | ||
F.data == 'show-user-balance', | ||
StateFilter('*'), | ||
) | ||
async def on_show_user_balance( | ||
message_or_callback_query: Message | CallbackQuery, | ||
balance_repository: BalanceRepository, | ||
) -> None: | ||
user_id = message_or_callback_query.from_user.id | ||
user_balance = await balance_repository.get_user_balance(user_id) | ||
view = UserBalanceView(user_balance) | ||
await render_message_or_callback_query( | ||
message_or_callback_query=message_or_callback_query, | ||
view=view, | ||
) |
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
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
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
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
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
Oops, something went wrong.