style: apply oxfmt

This commit is contained in:
Peter Steinberger
2026-01-18 02:19:35 +00:00
parent b659db0a5b
commit 0c93b9b7bb
21 changed files with 87 additions and 89 deletions

View File

@@ -302,7 +302,9 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
guildEntries = nextGuilds;
summarizeMapping("discord channel users", mapping, unresolved, runtime);
} catch (err) {
runtime.log?.(`discord channel user resolve failed; using config entries. ${String(err)}`);
runtime.log?.(
`discord channel user resolve failed; using config entries. ${String(err)}`,
);
}
}
}

View File

@@ -60,11 +60,7 @@ function parseDiscordChannelInput(raw: string): {
return { guild: trimmed, guildOnly: true };
}
async function fetchDiscord<T>(
path: string,
token: string,
fetcher: typeof fetch,
): Promise<T> {
async function fetchDiscord<T>(path: string, token: string, fetcher: typeof fetch): Promise<T> {
const res = await fetcher(`${DISCORD_API_BASE}${path}`, {
headers: { Authorization: `Bot ${token}` },
});
@@ -107,7 +103,7 @@ async function listGuildChannels(
: undefined;
return {
id: channel.id,
name: "name" in channel ? channel.name ?? "" : "",
name: "name" in channel ? (channel.name ?? "") : "",
guildId,
type: channel.type,
archived,
@@ -129,7 +125,7 @@ async function fetchChannel(
if (!raw || !("guild_id" in raw)) return null;
return {
id: raw.id,
name: "name" in raw ? raw.name ?? "" : "",
name: "name" in raw ? (raw.name ?? "") : "",
guildId: raw.guild_id ?? "",
type: raw.type,
};

View File

@@ -81,11 +81,7 @@ async function listGuilds(token: string, fetcher: typeof fetch): Promise<Discord
function scoreDiscordMember(member: DiscordMember, query: string): number {
const q = query.toLowerCase();
const user = member.user;
const candidates = [
user.username,
user.global_name,
member.nick ?? undefined,
]
const candidates = [user.username, user.global_name, member.nick ?? undefined]
.map((value) => value?.toLowerCase())
.filter(Boolean) as string[];
let score = 0;