fix(channels): clean up discord resolve typing

This commit is contained in:
Peter Steinberger
2026-01-18 00:59:23 +00:00
parent 075ff675ac
commit 4f0771f67b
4 changed files with 35 additions and 25 deletions

View File

@@ -156,7 +156,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
token,
entries: entries.map((entry) => entry.input),
});
const nextGuilds = { ...(guildEntries ?? {}) };
const nextGuilds = { ...guildEntries };
const mapping: string[] = [];
const unresolved: string[] = [];
for (const entry of resolved) {
@@ -173,10 +173,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
: `${entry.input}${entry.guildId}`,
);
const existing = nextGuilds[entry.guildId] ?? {};
const mergedChannels = {
...(sourceGuild.channels ?? {}),
...(existing.channels ?? {}),
};
const mergedChannels = { ...sourceGuild.channels, ...existing.channels };
const mergedGuild = { ...sourceGuild, ...existing, channels: mergedChannels };
nextGuilds[entry.guildId] = mergedGuild;
if (source.channelKey && entry.channelId) {
@@ -188,7 +185,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
...mergedChannels,
[entry.channelId]: {
...sourceChannel,
...(mergedChannels?.[entry.channelId] ?? {}),
...mergedChannels?.[entry.channelId],
},
},
};
@@ -266,7 +263,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
.filter((entry) => !entry.resolved)
.map((entry) => entry.input);
const nextGuilds = { ...(guildEntries ?? {}) };
const nextGuilds = { ...guildEntries };
for (const [guildKey, guildConfig] of Object.entries(guildEntries ?? {})) {
if (!guildConfig || typeof guildConfig !== "object") continue;
const nextGuild = { ...guildConfig } as Record<string, unknown>;