mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 01:01:23 +00:00
Fix Discord auto-thread attempting to thread in Forum/Media channels\n\nCreating threads on messages within Forum/Media channels is often redundant\nor invalid (as messages are already posts). This prevents API errors and spam.\n\nFix: Check channel type before attempting auto-thread creation.
This commit is contained in:
@@ -298,6 +298,7 @@ export async function resolveDiscordAutoThreadReplyPlan(params: {
|
||||
isGuildMessage: boolean;
|
||||
channelConfig?: DiscordChannelConfigResolved | null;
|
||||
threadChannel?: DiscordThreadChannel | null;
|
||||
channelType?: ChannelType;
|
||||
baseText: string;
|
||||
combinedBody: string;
|
||||
replyToMode: ReplyToMode;
|
||||
@@ -320,6 +321,7 @@ export async function resolveDiscordAutoThreadReplyPlan(params: {
|
||||
isGuildMessage: params.isGuildMessage,
|
||||
channelConfig: params.channelConfig,
|
||||
threadChannel: params.threadChannel,
|
||||
channelType: params.channelType,
|
||||
baseText: params.baseText,
|
||||
combinedBody: params.combinedBody,
|
||||
});
|
||||
@@ -348,6 +350,7 @@ export async function maybeCreateDiscordAutoThread(params: {
|
||||
isGuildMessage: boolean;
|
||||
channelConfig?: DiscordChannelConfigResolved | null;
|
||||
threadChannel?: DiscordThreadChannel | null;
|
||||
channelType?: ChannelType;
|
||||
baseText: string;
|
||||
combinedBody: string;
|
||||
}): Promise<string | undefined> {
|
||||
@@ -360,6 +363,16 @@ export async function maybeCreateDiscordAutoThread(params: {
|
||||
if (params.threadChannel) {
|
||||
return undefined;
|
||||
}
|
||||
// Avoid creating threads in channels that don't support it or are already forums
|
||||
if (
|
||||
params.channelType === ChannelType.GuildForum ||
|
||||
params.channelType === ChannelType.GuildMedia ||
|
||||
params.channelType === ChannelType.GuildVoice ||
|
||||
params.channelType === ChannelType.GuildStageVoice
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const messageChannelId = (
|
||||
params.messageChannelId ||
|
||||
resolveDiscordMessageChannelId({
|
||||
|
||||
Reference in New Issue
Block a user