Merge 75a7c81476 into da71eaebd2
This commit is contained in:
commit
b5d3c51603
@ -279,6 +279,7 @@ export async function handleDiscordMessagingAction(
|
|||||||
const channelId = resolveChannelId();
|
const channelId = resolveChannelId();
|
||||||
const name = readStringParam(params, "name", { required: true });
|
const name = readStringParam(params, "name", { required: true });
|
||||||
const messageId = readStringParam(params, "messageId");
|
const messageId = readStringParam(params, "messageId");
|
||||||
|
const message = readStringParam(params, "message");
|
||||||
const autoArchiveMinutesRaw = params.autoArchiveMinutes;
|
const autoArchiveMinutesRaw = params.autoArchiveMinutes;
|
||||||
const autoArchiveMinutes =
|
const autoArchiveMinutes =
|
||||||
typeof autoArchiveMinutesRaw === "number" && Number.isFinite(autoArchiveMinutesRaw)
|
typeof autoArchiveMinutesRaw === "number" && Number.isFinite(autoArchiveMinutesRaw)
|
||||||
@ -287,10 +288,10 @@ export async function handleDiscordMessagingAction(
|
|||||||
const thread = accountId
|
const thread = accountId
|
||||||
? await createThreadDiscord(
|
? await createThreadDiscord(
|
||||||
channelId,
|
channelId,
|
||||||
{ name, messageId, autoArchiveMinutes },
|
{ name, messageId, message, autoArchiveMinutes },
|
||||||
{ accountId },
|
{ accountId },
|
||||||
)
|
)
|
||||||
: await createThreadDiscord(channelId, { name, messageId, autoArchiveMinutes });
|
: await createThreadDiscord(channelId, { name, messageId, message, autoArchiveMinutes });
|
||||||
return jsonResult({ ok: true, thread });
|
return jsonResult({ ok: true, thread });
|
||||||
}
|
}
|
||||||
case "threadList": {
|
case "threadList": {
|
||||||
|
|||||||
@ -180,6 +180,7 @@ export async function handleDiscordMessageAction(
|
|||||||
if (action === "thread-create") {
|
if (action === "thread-create") {
|
||||||
const name = readStringParam(params, "threadName", { required: true });
|
const name = readStringParam(params, "threadName", { required: true });
|
||||||
const messageId = readStringParam(params, "messageId");
|
const messageId = readStringParam(params, "messageId");
|
||||||
|
const message = readStringParam(params, "message");
|
||||||
const autoArchiveMinutes = readNumberParam(params, "autoArchiveMin", {
|
const autoArchiveMinutes = readNumberParam(params, "autoArchiveMin", {
|
||||||
integer: true,
|
integer: true,
|
||||||
});
|
});
|
||||||
@ -190,6 +191,7 @@ export async function handleDiscordMessageAction(
|
|||||||
channelId: resolveChannelId(),
|
channelId: resolveChannelId(),
|
||||||
name,
|
name,
|
||||||
messageId,
|
messageId,
|
||||||
|
message,
|
||||||
autoArchiveMinutes,
|
autoArchiveMinutes,
|
||||||
},
|
},
|
||||||
cfg,
|
cfg,
|
||||||
|
|||||||
@ -97,6 +97,14 @@ export async function createThreadDiscord(
|
|||||||
if (payload.autoArchiveMinutes) {
|
if (payload.autoArchiveMinutes) {
|
||||||
body.auto_archive_duration = payload.autoArchiveMinutes;
|
body.auto_archive_duration = payload.autoArchiveMinutes;
|
||||||
}
|
}
|
||||||
|
// Forum channels (type 15) require a message object for thread creation
|
||||||
|
if (payload.message) {
|
||||||
|
body.message = { content: payload.message };
|
||||||
|
// For forum posts, POST directly to /channels/{channelId}/threads
|
||||||
|
const route = `/channels/${channelId}/threads`;
|
||||||
|
return await rest.post(route, { body });
|
||||||
|
}
|
||||||
|
// Regular thread from an existing message
|
||||||
const route = Routes.threads(channelId, payload.messageId);
|
const route = Routes.threads(channelId, payload.messageId);
|
||||||
return await rest.post(route, { body });
|
return await rest.post(route, { body });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,6 +68,7 @@ export type DiscordMessageEdit = {
|
|||||||
|
|
||||||
export type DiscordThreadCreate = {
|
export type DiscordThreadCreate = {
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
|
message?: string;
|
||||||
name: string;
|
name: string;
|
||||||
autoArchiveMinutes?: number;
|
autoArchiveMinutes?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user