1"""Discord role names/colors/positions, replaced wholesale by the bot on its live-status loop."""
2
3from advanced_alchemy.base import UUIDAuditBase
4from sqlalchemy import BigInteger, Boolean, Integer, Text, UniqueConstraint
5from sqlalchemy.orm import Mapped, mapped_column
6
7
[docs]
8class GuildRole(UUIDAuditBase):
9 """One Discord role in a guild, as last reported by the bot. ``@everyone`` is excluded by the bot."""
10
11 __tablename__ = "guild_role"
12 __table_args__ = (
13 UniqueConstraint("guild_id", "role_id", name="uq_guild_role_guild_role"),
14 {"comment": "Discord role names/colors/positions, as last reported by the bot."},
15 )
16
17 guild_id: Mapped[int] = mapped_column(BigInteger, index=True)
18 role_id: Mapped[int] = mapped_column(BigInteger)
19 name: Mapped[str] = mapped_column(Text)
20 color: Mapped[int] = mapped_column(Integer, default=0)
21 position: Mapped[int] = mapped_column(Integer, default=0)
22 managed: Mapped[bool] = mapped_column(Boolean, default=False)