-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add transaction to change_karma services * split ban and ro to handler part and service part * fixes, separate logic between functions, refactoring * add __all__ for linter fix * add automatically restriction after very low karma * fixes * add config param to enable/disable auto restrict on negative karma * move render message in separate function * move condition to separate function * move TypeRestriction to models package * rename variable * add function for check has user restriction or not * fix exception clause * fix typehint (change destination in pyrogram) * add auto restrict on negative karma * last one restriction on negative karma must be ban * text fixes * update .gitignore * fix texts * refactor more logic karmic ro * user cant negative karma to target with RO new exception and Exception group - for skip negative karma process remove deprecated filters * BUGFIXES, fix cancel change karma * correct shield restricted from decrease karma and notify user for that * fix typos remove unused comments remove unused imports * fix race condition in case one user change karma and make it less than -100, bot change karma to -80 than another user change same karma and than first user cancel his action. Now it case correct work cancel imitate that user newer do cancelled action * rename consts * add few info to README.md Co-authored-by: Yuriy Chebyshev <cheb.yuriy@gmail.com>
- Loading branch information
Showing
19 changed files
with
497 additions
and
172 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 |
---|---|---|
|
@@ -10,3 +10,5 @@ log/ | |
*/.pytest_cache/ | ||
jsons/ | ||
*.session | ||
__pycache__/ | ||
db_data/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton | ||
from aiogram.utils.callback_data import CallbackData | ||
|
||
from app.models import User, KarmaEvent | ||
from app.models import User, KarmaEvent, ModeratorEvent | ||
|
||
cb_karma_cancel = CallbackData("karma_cancel", "user_id", "action_id") | ||
cb_karma_cancel = CallbackData("karma_cancel", "user_id", "karma_event_id", "rollback_karma", "moderator_event_id") | ||
|
||
|
||
def get_kb_karma_cancel(user: User, action: KarmaEvent) -> InlineKeyboardMarkup: | ||
def get_kb_karma_cancel( | ||
user: User, karma_event: KarmaEvent, rollback_karma: float, moderator_event: ModeratorEvent | ||
) -> InlineKeyboardMarkup: | ||
return InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton( | ||
"Отменить", callback_data=cb_karma_cancel.new(user_id=user.tg_id, action_id=action.id_) | ||
"Отменить", callback_data=cb_karma_cancel.new( | ||
user_id=user.tg_id, | ||
karma_event_id=karma_event.id_, | ||
rollback_karma=f"{rollback_karma:.2f}", | ||
moderator_event_id=moderator_event.id_ if moderator_event is not None else "null", | ||
) | ||
)]]) |
Oops, something went wrong.
13a23fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как правильно запустить тесты? Ни один не проходит.
13a23fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python -m pytest
pls, next time ask it in "issues"