On branch DiscordProfile

Initial commit
This commit is contained in:
EG
2026-07-01 15:15:07 +03:00
commit d4bf750c9e
3125 changed files with 601334 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
from services.profile_manager import load_profile, save_profile
def set_attach(
slot: int,
name: str,
description: str,
icon: str = "",
mini_icon: str = ""
):
"""
Меняет один из 6 attach-слотов
"""
if slot < 1 or slot > 6:
raise ValueError("Attach slot должен быть от 1 до 6")
profile = load_profile()
attachments = profile.setdefault(
"attachments",
[
{},
{},
{},
{},
{},
{}
]
)
attachments[slot - 1] = {
"name": name,
"description": description,
"icon": icon,
"mini_icon": mini_icon
}
profile["attachments"] = attachments
save_profile(profile)
return attachments[slot - 1]
def get_attach(slot: int):
if slot < 1 or slot > 6:
raise ValueError("Attach slot должен быть от 1 до 6")
profile = load_profile()
attachments = profile.get(
"attachments",
[
{},
{},
{},
{},
{},
{}
]
)
return attachments[slot - 1]
def clear_attach(slot: int):
if slot < 1 or slot > 6:
raise ValueError("Attach slot должен быть от 1 до 6")
profile = load_profile()
profile["attachments"][slot - 1] = {}
save_profile(profile)