Skip to main content

Function: getCurrentThreadInfo()

function getCurrentThreadInfo(
guildId,
cardId,
threadParentId): object | null

Retrieves the current thread ID and its column information for a card.

This helper determines which column a card's current thread belongs to by looking up the thread's parent forum ID in the forumChannels mapping. This is used during sync to detect when a card has moved to a different column.

Parameters

ParameterTypeDescription
guildIdstringThe Discord guild ID
cardIdstringThe provider card ID (e.g., "PROJ-123")
threadParentIdstringThe thread's parent forum channel ID

Returns

object | null

Object with threadId and column, or null if no thread exists or column cannot be determined

Example

const thread = await forum.client.channels.fetch(existingThreadId);
if (thread && thread.isThread()) {
const currentInfo = getCurrentThreadInfo(guildId, card.id, thread.parentId);
if (currentInfo && card.column !== currentInfo.column) {
console.log('Column has changed!');
}
}