mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:47:39 +00:00
Discord: allow disabling thread starter context
This commit is contained in:
@@ -31,6 +31,7 @@ export type DiscordGuildEntryResolved = {
|
||||
enabled?: boolean;
|
||||
users?: Array<string | number>;
|
||||
systemPrompt?: string;
|
||||
includeThreadStarter?: boolean;
|
||||
autoThread?: boolean;
|
||||
}
|
||||
>;
|
||||
@@ -43,6 +44,7 @@ export type DiscordChannelConfigResolved = {
|
||||
enabled?: boolean;
|
||||
users?: Array<string | number>;
|
||||
systemPrompt?: string;
|
||||
includeThreadStarter?: boolean;
|
||||
autoThread?: boolean;
|
||||
matchKey?: string;
|
||||
matchSource?: ChannelMatchSource;
|
||||
@@ -241,6 +243,7 @@ function resolveDiscordChannelConfigEntry(
|
||||
enabled: entry.enabled,
|
||||
users: entry.users,
|
||||
systemPrompt: entry.systemPrompt,
|
||||
includeThreadStarter: entry.includeThreadStarter,
|
||||
autoThread: entry.autoThread,
|
||||
};
|
||||
return resolved;
|
||||
|
||||
@@ -209,22 +209,25 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
let threadLabel: string | undefined;
|
||||
let parentSessionKey: string | undefined;
|
||||
if (threadChannel) {
|
||||
const starter = await resolveDiscordThreadStarter({
|
||||
channel: threadChannel,
|
||||
client,
|
||||
parentId: threadParentId,
|
||||
parentType: threadParentType,
|
||||
resolveTimestampMs,
|
||||
});
|
||||
if (starter?.text) {
|
||||
const starterEnvelope = formatThreadStarterEnvelope({
|
||||
channel: "Discord",
|
||||
author: starter.author,
|
||||
timestamp: starter.timestamp,
|
||||
body: starter.text,
|
||||
envelope: envelopeOptions,
|
||||
const includeThreadStarter = channelConfig?.includeThreadStarter !== false;
|
||||
if (includeThreadStarter) {
|
||||
const starter = await resolveDiscordThreadStarter({
|
||||
channel: threadChannel,
|
||||
client,
|
||||
parentId: threadParentId,
|
||||
parentType: threadParentType,
|
||||
resolveTimestampMs,
|
||||
});
|
||||
threadStarterBody = starterEnvelope;
|
||||
if (starter?.text) {
|
||||
const starterEnvelope = formatThreadStarterEnvelope({
|
||||
channel: "Discord",
|
||||
author: starter.author,
|
||||
timestamp: starter.timestamp,
|
||||
body: starter.text,
|
||||
envelope: envelopeOptions,
|
||||
});
|
||||
threadStarterBody = starterEnvelope;
|
||||
}
|
||||
}
|
||||
const parentName = threadParentName ?? "parent";
|
||||
threadLabel = threadName
|
||||
|
||||
Reference in New Issue
Block a user