feat(groups): add fail-closed admission management
CI / validate (push) Successful in 5m13s
Release / release (push) Successful in 7m8s

This commit is contained in:
dmg
2026-08-01 18:36:45 -04:00
parent 19a5d04178
commit b88097c15a
32 changed files with 1910 additions and 29 deletions
+33
View File
@@ -0,0 +1,33 @@
import { getGuildMemberIdentity } from "@minecraft-account-manager/minecraft";
import { logger } from "@/lib/logger";
export async function discordIdentity(input: {
discordUserId: string;
discordUsername: string;
discordGlobalName: string | null;
}) {
const guildId = process.env.DISCORD_GUILD_ID?.trim();
const botToken = process.env.DISCORD_BOT_TOKEN?.trim();
const fallback = {
id: input.discordUserId,
username: input.discordUsername,
globalName: input.discordGlobalName,
nickname: null as string | null,
live: false,
};
if (!guildId || !botToken) return fallback;
try {
return { ...await getGuildMemberIdentity({
guildId,
discordUserId: input.discordUserId,
botToken,
}), live: true };
} catch (error) {
logger.warn(
{ err: error, event: "discord.identity_lookup_failed", discordUserId: input.discordUserId },
"Discord guild identity lookup failed",
);
return fallback;
}
}