-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadd_super_admin.py
More file actions
58 lines (46 loc) · 2.18 KB
/
add_super_admin.py
File metadata and controls
58 lines (46 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Контакты разработчика:
# VK: vk.com/dimawinchester
# Telegram: t.me/teanus
# Github: github.com/teanus
#
#
#
# ████████╗███████╗ █████╗ ███╗ ██╗██╗ ██╗███████╗
# ╚══██╔══╝██╔════╝██╔══██╗████╗ ██║██║ ██║██╔════╝
# ██║ █████╗ ███████║██╔██╗ ██║██║ ██║███████╗
# ██║ ██╔══╝ ██╔══██║██║╚██╗██║██║ ██║╚════██║
# ██║ ███████╗██║ ██║██║ ╚████║╚██████╔╝███████║
# ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝
from provider import db
from render_template import render_template_jinja
from resources import config
async def console_add_super_admin() -> str:
"""
Добавляет супер-администратора через консоль.
:return: Возвращает строку с результатом выполнения.
:rtype: str
"""
root = "template"
if not config.console()["give_role"]:
return render_template_jinja(
"add_super_admin/false_give_role.jinja2", root_directory_name=root
)
admin_id = input(
render_template_jinja(
"add_super_admin/messages.jinja2", root_directory_name=root
)
)
if admin_id == "":
return render_template_jinja(
"add_super_admin/exit.jinja2", root_directory_name=root
)
context = {"admin_id": admin_id}
if await db.check_admin(admin_id):
return render_template_jinja(
"add_super_admin/admin_exists.jinja2", root_directory_name=root, **context
)
await db.add_admin(admin_id)
return render_template_jinja(
"add_super_admin/add_admin.jinja2", root_directory_name=root, **context
)