Skip to main content

Data Types

You can import any of these types directly from the package:

import type { TranscriptData, DiscordMessage, DiscordPoll } from "@getoeteter/discord-transcripts";

TranscriptData

This is what you pass to generateTranscriptHtml:

interface TranscriptData {
guild?: DiscordGuild;
channel: DiscordChannel;
messages: DiscordMessage[];
roles?: Record<string, DiscordRole>; // For mention coloring
channels?: Record<string, DiscordChannel>; // For channel mention names
memberRoles?: Record<string, string[]>; // User ID → role IDs
generatedAt?: string; // ISO timestamp
totalMessages?: number; // Override message count display
}

DiscordGuild

interface DiscordGuild {
id: string;
name: string;
icon?: string | null; // CDN hash or full https:// URL
}

DiscordChannel

interface DiscordChannel {
id: string;
name: string;
type: number; // 0 = Text, 2 = Voice, 5 = Announcement, etc.
topic?: string | null;
}

DiscordRole

interface DiscordRole {
id: string;
name: string;
color: number; // Integer color (0 = no color)
}

DiscordMessage

interface DiscordMessage {
id: string;
type: DiscordMessageType;
content: string;
author: DiscordUser;
timestamp: string; // ISO timestamp
editedTimestamp?: string | null;
mentions?: DiscordMention[];
attachments?: DiscordAttachment[];
embeds?: DiscordEmbed[];
reactions?: DiscordReaction[];
pinned?: boolean;
webhookId?: string | null;
messageReference?: DiscordMessageReference | null;
referencedMessage?: DiscordMessage | null;
thread?: DiscordThread | null;
components?: DiscordComponent[];
stickers?: DiscordSticker[];
poll?: DiscordPoll;
interaction?: DiscordInteraction;
voiceMessage?: DiscordVoiceMessage;
}

Message Types

ValueNameDescription
0DefaultRegular message
7UserJoinMember join system message
8PremiumGuildSubscriptionBoost
9PremiumGuildSubscriptionTier1Boost tier 1
10PremiumGuildSubscriptionTier2Boost tier 2
11PremiumGuildSubscriptionTier3Boost tier 3
18GuildMemberJoinJoin via discovery
19ReplyReply to a message
20ChatInputCommandSlash command response
21ThreadStarterMessageThread start
23ContextMenuCommandContext menu response
24AutoModerationAutoMod system message
25RoleSubscriptionPurchaseRole sub
27StageStartStage starts
28StageEndStage ends
29StageSpeakerStage speaker
31StageTopicStage topic change

DiscordUser

interface DiscordUser {
id: string;
username: string;
discriminator?: string;
globalName?: string | null;
avatar?: string | null; // CDN hash or full https:// URL
bot?: boolean;
}
tip

The avatar field accepts either a Discord CDN hash (e.g. "a_1234abcd") or a direct URL (e.g. "https://cdn.discordapp.com/avatars/..."). The renderer detects which format is used automatically.


DiscordEmbed

interface DiscordEmbed {
title?: string;
type?: string; // "rich", "image", "gifv", "video", "link"
description?: string;
url?: string;
timestamp?: string;
color?: number; // Integer color (e.g. 0x5865f2)
footer?: { text: string; iconUrl?: string };
image?: { url: string; width?: number; height?: number };
thumbnail?: { url: string; width?: number; height?: number };
video?: { url?: string; proxyUrl?: string; width?: number; height?: number };
provider?: { name?: string; url?: string };
author?: { name: string; url?: string; iconUrl?: string };
fields?: { name: string; value: string; inline?: boolean }[];
}

DiscordAttachment

interface DiscordAttachment {
id: string;
filename: string;
description?: string | null;
contentType?: string | null; // MIME type
size: number; // Bytes
url: string;
width?: number | null;
height?: number | null;
spoiler?: boolean;
}

How attachments look depends on the content type:

  • Images (image/*) - shown inline with optional spoiler blur
  • Video (video/*) - embedded <video> player
  • Audio (audio/*) - embedded <audio> player
  • Anything else - download link with file size

DiscordPoll

interface DiscordPoll {
question: DiscordPollMedia;
answers: DiscordPollAnswer[];
allowMultiselect?: boolean;
expiry?: string; // ISO timestamp
isFinalized?: boolean;
}

interface DiscordPollAnswer {
answerId: number;
pollMedia: DiscordPollMedia;
count?: number; // Vote count
}

interface DiscordPollMedia {
text?: string;
emoji?: DiscordEmoji;
}

See Polls feature for rendering details.


DiscordInteraction

interface DiscordInteraction {
name: string; // Slash command or context menu name
user: DiscordUser; // User who triggered it
}

See Slash Command Context for rendering details.


DiscordVoiceMessage

interface DiscordVoiceMessage {
duration: number; // Seconds
waveform?: string; // Base64-encoded waveform data
}

See Voice Messages for rendering details.


DiscordComponent

interface DiscordComponent {
type: number;
style?: number; // Button style (1-5)
label?: string;
emoji?: DiscordEmoji;
customId?: string;
url?: string;
disabled?: boolean;
components?: DiscordComponent[]; // Children
content?: string; // V2 TextDisplay/Label
accentColor?: number; // V2 Container border color
spoiler?: boolean;
accessory?: DiscordComponentAccessory;
items?: DiscordMediaGalleryItem[];
file?: { url: string; contentType?: string };
spacing?: number; // Separator: 1 = small, 2 = large
divider?: boolean;
media?: { url: string };
description?: string;
}

Component Types

V1 Components:

TypeNameDescription
1ActionRowContainer for buttons/selects
2ButtonClickable button
3StringSelectDropdown select menu
5UserSelectUser picker
6RoleSelectRole picker
7MentionableSelectMentionable picker
8ChannelSelectChannel picker

V2 Components:

TypeNameDescription
9SectionSection with optional accessory
10TextDisplayRich text display
11ThumbnailSmall image
12MediaGalleryImage grid
13FileFile display
14SeparatorDivider line
17ContainerBordered container
18LabelSimple text label

DiscordThread

interface DiscordThread {
id: string;
name: string;
messageCount?: number;
messages?: DiscordMessage[]; // For inline expansion (expandThreads option)
}

DiscordReaction

interface DiscordReaction {
emoji: DiscordEmoji;
count: number;
me?: boolean;
}

interface DiscordEmoji {
id: string | null; // null for Unicode emoji
name: string; // Unicode char or custom emoji name
animated?: boolean;
}

DiscordSticker

interface DiscordSticker {
id: string;
name: string;
formatType: number; // 1 = PNG, 2 = APNG, 3 = Lottie, 4 = GIF
}