commit
aaa
diff --git a/columbina/client.py b/columbina/client.py
index 7b365c3..69973a5 100644
--- a/columbina/client.py
+++ b/columbina/client.py
@@ -333,6 +333,33 @@ class Bot(commands.Bot):
print(cf.green(f"[sync] {len(synced)} slash command(s) live in {target}"))
return len(synced)
+ async def applyNameStyle(self) -> None:
+ """Set her display name font/effect/colours in every server she's in.
+
+ discord.py has no wrapper for these fields yet, so they go straight
+ through the raw member-edit route. It's per-guild because bots can't
+ style their global profile.
+ """
+ fields = {
+ key: value
+ for key, value in (
+ ("display_name_font_id", config.displayNameFont),
+ ("display_name_effect_id", config.displayNameEffect),
+ ("display_name_colors", config.displayNameColors),
+ )
+ if value is not None
+ }
+ if not fields:
+ return
+
+ for guild in self.guilds:
+ try:
+ await self.http.edit_my_member(guild.id, **fields)
+ except discord.HTTPException as e:
+ print(cf.red(f"[style] couldn't style my name in {guild.id}: {e}"))
+ else:
+ print(cf.yellow(f"[style] name style set in {guild.name}"))
+
async def on_ready(self) -> None:
# Guarded: on_ready fires again on every reconnect, and syncing is
# rate-limited.
@@ -354,6 +381,7 @@ class Bot(commands.Bot):
print(cf.yellow("Avatar and Banner loaded!"))
except (discord.HTTPException, OSError) as e:
print(cf.red(f"Failed to set avatar/banner: {e}"))
+ await self.applyNameStyle()
print(cf.magenta(f"Logged in as {self.user}"))
diff --git a/columbina/config.py b/columbina/config.py
index d6993b5..ac02ae2 100644
--- a/columbina/config.py
+++ b/columbina/config.py
@@ -56,6 +56,26 @@ def resolveDir(raw: str | None, fallback: Path) -> Path:
databaseDir = resolveDir(os.getenv("DATABASE_DIR"), repoRoot / "data")
databasePath = databaseDir / "columbina.jp"
+# How her name is drawn in member lists and chat. Bots can't style their global
+# profile, only their member in each server (PATCH /guilds/{id}/members/@me —
+# see https://docs.discord.food/resources/user#display-name-style-object).
+#
+# Fonts: 11 gg Sans (default), 3 Sakura, 4 Jellybean, 6 Modern, 7 Medieval,
+# 8 8Bit, 10 Vampyre, 12 Tempo, 13 Monkey Bars, 14 Mainframe,
+# 15 Headbang, 16 Journal
+# Effects: 1 Solid, 2 Gradient, 3 Neon, 4 Toon, 5 Pop, 6 Glow, 7 Prism, 8 Gummy
+# Colors: as 0xRRGGBB; Solid/Neon/Toon/Pop take 1, the rest up to 5.
+# Set an entry to None to leave it alone.
+displayNameFont: int | None = 16 # Journal
+displayNameEffect: int | None = 7 # Prism
+displayNameColors: list[int] | None = [
+ 0x5BCEFA,
+ 0xF5A9B8,
+ 0xFFFFFF,
+ 0xF5A9B8,
+ 0x5BCEFA,
+]
+
prefixNames: list[str] = sorted(("damselette", "columbina", "bina"), key=len, reverse=True)
owners: list[int] = [