-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add users inbounds manage (#88)
* feat: add users inbounds edit * fix: check deleted inbounds * feat: bump to 0.2.1
- Loading branch information
Showing
13 changed files
with
285 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from aiogram import Router, F | ||
from aiogram.types import CallbackQuery | ||
from models import ( | ||
PagesActions, | ||
PagesCallbacks, | ||
AdminActions, | ||
ConfirmCallbacks, | ||
BotActions, | ||
UserInboundsCallbacks, | ||
) | ||
from utils.lang import MessageTexts | ||
from utils.keys import BotKeyboards | ||
from utils import panel, helpers | ||
|
||
router = Router() | ||
|
||
|
||
@router.callback_query(PagesCallbacks.filter(F.page == PagesActions.UsersMenu)) | ||
async def menu(callback: CallbackQuery): | ||
return await callback.message.edit_text( | ||
text=MessageTexts.UsersMenu, reply_markup=BotKeyboards.users() | ||
) | ||
|
||
|
||
@router.callback_query(ConfirmCallbacks.filter(F.page == BotActions.UsersInbound)) | ||
async def inbound_add(callback: CallbackQuery, callback_data: ConfirmCallbacks): | ||
inbounds = await panel.inbounds() | ||
return await callback.message.edit_text( | ||
text=MessageTexts.UsersInboundSelect, | ||
reply_markup=BotKeyboards.inbounds( | ||
inbounds=inbounds, action=callback_data.action, just_one_inbound=True | ||
), | ||
) | ||
|
||
|
||
@router.callback_query( | ||
UserInboundsCallbacks.filter( | ||
( | ||
F.action.in_([AdminActions.Add, AdminActions.Delete]) | ||
& (F.is_done.is_(True)) | ||
& (F.just_one_inbound.is_(True)) | ||
) | ||
) | ||
) | ||
async def inbound_confirm( | ||
callback: CallbackQuery, callback_data: UserInboundsCallbacks | ||
): | ||
working_message = await callback.message.edit_text(text=MessageTexts.Working) | ||
result = await helpers.manage_panel_inbounds( | ||
callback_data.tag, | ||
callback_data.protocol, | ||
( | ||
AdminActions.Add | ||
if callback_data.action.value == AdminActions.Add.value | ||
else AdminActions.Delete | ||
), | ||
) | ||
|
||
return await working_message.edit_text( | ||
text=( | ||
MessageTexts.UsersInboundSuccessUpdated | ||
if result | ||
else MessageTexts.UsersInboundErrorUpdated | ||
), | ||
reply_markup=BotKeyboards.home(), | ||
) |
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.