refactor: share discord preflight shared fields

This commit is contained in:
Peter Steinberger 2026-03-13 22:30:01 +00:00
parent 801113b46a
commit 58a51e2746
1 changed files with 4 additions and 14 deletions

View File

@ -16,7 +16,7 @@ export type RuntimeEnv = import("../../runtime.js").RuntimeEnv;
export type DiscordMessageEvent = import("./listeners.js").DiscordMessageEvent;
export type DiscordMessagePreflightContext = {
type DiscordMessagePreflightSharedFields = {
cfg: LoadedConfig;
discordConfig: NonNullable<
import("../../config/config.js").OpenClawConfig["channels"]
@ -33,7 +33,9 @@ export type DiscordMessagePreflightContext = {
replyToMode: ReplyToMode;
ackReactionScope: "all" | "direct" | "group-all" | "group-mentions" | "off" | "none";
groupPolicy: "open" | "disabled" | "allowlist";
};
export type DiscordMessagePreflightContext = DiscordMessagePreflightSharedFields & {
data: DiscordMessageEvent;
client: Client;
message: DiscordMessageEvent["message"];
@ -89,19 +91,7 @@ export type DiscordMessagePreflightContext = {
discordRestFetch?: typeof fetch;
};
export type DiscordMessagePreflightParams = {
cfg: LoadedConfig;
discordConfig: DiscordMessagePreflightContext["discordConfig"];
accountId: string;
token: string;
runtime: RuntimeEnv;
botUserId?: string;
abortSignal?: AbortSignal;
guildHistories: Map<string, HistoryEntry[]>;
historyLimit: number;
mediaMaxBytes: number;
textLimit: number;
replyToMode: ReplyToMode;
export type DiscordMessagePreflightParams = DiscordMessagePreflightSharedFields & {
dmEnabled: boolean;
groupDmEnabled: boolean;
groupDmChannels?: string[];