generateFromMessages
Example
const discordTranscripts = require("discord-html-transcripts");
const { Collection } = require("discord.js");
[...]
const messages = new Collection();
const channel = /* somehow get this */;
// somehow fill the messages collection
const transcript = await discordTranscripts.generateFromMessages(
messages, // the content in the transcript
channel, // used for transcript title, etc
{ /* options */ }
);
// By default returns an AttachmentBuilder that can be sent in a channel.
channel.send({
files: [attachment]
});import * as discordTranscripts from "discord-html-transcripts";
import { Collection, Message } from "discord.js";
[...]
const messages = new Collection<string, Message>();
const channel = /* somehow get this */;
// somehow fill the messages collection
const transcript = await discordTranscripts.generateFromMessages(
messages, // the content in the transcript
channel, // used for transcript title, etc
{ /* options */ }
);
// By default returns an AttachmentBuilder that can be sent in a channel.
channel.send({
files: [attachment]
});Parameters
messages: Message[] | Collection<string, Message>
messages: Message[] | Collection<string, Message>channel: TextBasedChannel
channel: TextBasedChanneloptions: GenerateFromMessagesOptions
options: GenerateFromMessagesOptionsoptions.returnType: 'buffer' | 'string' | 'attachment'
options.returnType: 'buffer' | 'string' | 'attachment'options.filename: string
options.filename: stringoptions.saveImages: boolean
options.saveImages: booleanoptions.footerText: string
options.footerText: stringoptions.poweredBy: boolean
options.poweredBy: booleanoptions.callbacks.resolveChannel: (channelId: string) => Awaitable<Channel | null>
options.callbacks.resolveChannel: (channelId: string) => Awaitable<Channel | null>options.callbacks.resolveUser: (userId: string) => Awaitable<User | null>
options.callbacks.resolveUser: (userId: string) => Awaitable<User | null>options.callbacks.resolveRole: (roleId: string) => Awaitable<Role | null>
options.callbacks.resolveRole: (roleId: string) => Awaitable<Role | null>A custom function that will be used by the module whenever it needs to resolve a role (for example, if a role is mentioned)
Last updated