~nicoco/slidcord

80e1fe47ba4551903fffcf5447d22f249d3bcc6d — nicoco 4 months ago cebb9b5
feat: map member roles to XEP-0317 hats
1 files changed, 8 insertions(+), 0 deletions(-)

M slidcord/group.py
M slidcord/group.py => slidcord/group.py +8 -0
@@ 4,6 4,7 @@ from typing import Optional, Union
import discord as di
import discord.errors
from slidge import LegacyBookmarks, LegacyMUC, LegacyParticipant, MucType
from slidge.util.types import Hat
from slixmpp.exceptions import XMPPError

from . import config


@@ 74,6 75,13 @@ class MUC(LegacyMUC[int, int, Participant, int]):
            if isinstance(m, di.Member):
                p.update_status(m.status, m.activity)

            p.set_hats(
                [
                    Hat(f"urn:slidcord:discord-role:{role.id}", role.name)
                    for role in m.roles[1:]  # first role is @everyone, useless
                ]
            )

            if owner == m:
                p.role = "moderator"
                p.affiliation = "owner"