profile: use local DB instead of API for maintainer lookup

parent 65b2033c
......@@ -74,17 +74,17 @@ async def callback_confirm_handler(cb: CallbackQuery) -> None:
async def callback_confirm_handler(cb: CallbackQuery) -> None:
await cb.edit_text("Введите никнейм сопровождающего:")
api_data = await altrepo.api.site.all_maintainers("sisyphus")
while True:
msg, _ = await wm.wait(MESSAGE_FROM_USER, cb.from_user.id, release=HasText())
maintainer = msg.text.unwrap().lower()
if any(_m.packager_nickname == maintainer for _m in api_data.maintainers):
maintainer_obj = DB.maintainer.get(maintainer)
if maintainer_obj:
await msg.delete()
await cb.edit_text(f"Вы выбрали {maintainer}")
DB.user.change_maintainer(
cb.from_user.id,
maintainer
maintainer_obj
)
await sleep(3.0)
await cb.delete()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment