3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 07:20:00 +00:00
zeppelin/backend/src/utils/getChunkedEmbedFields.ts

24 lines
548 B
TypeScript
Raw Normal View History

import { EmbedField } from "eris";
import { chunkMessageLines, emptyEmbedValue } from "../utils";
export function getChunkedEmbedFields(name: string, value: string, inline?: boolean): 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],
});
} else {
fields.push({
name: emptyEmbedValue,
value: chunks[i],
});
}
}
return fields;
}