3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-08 00:05:01 +00:00
zeppelin/backend/src/utils/getChunkedEmbedFields.ts
Dragory 45e3fe2ef0
chore: esm imports
This will make merging this into 'next' much easier.
2024-08-11 21:58:52 +03:00

25 lines
585 B
TypeScript

import { EmbedField } from "discord.js";
import { chunkMessageLines, emptyEmbedValue } from "../utils.js";
export function getChunkedEmbedFields(name: string, value: string): EmbedField[] {
const fields: EmbedField[] = [];
const chunks = chunkMessageLines(value, 1014);
for (let i = 0; i < chunks.length; i++) {
if (i === 0) {
fields.push({
name,
value: chunks[i],
inline: false,
});
} else {
fields.push({
name: emptyEmbedValue,
value: chunks[i],
inline: false,
});
}
}
return fields;
}