MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / buildStandardLogEmbed

Function buildStandardLogEmbed

src/utils/logEmbeds.js:128–174  ·  view source on GitHub ↗
({
  color,
  title,
  description,
  thumbnail,
  image,
  inlineFields = [],
  fields = [],
  author = null,
  timestamp = true,
  footer,
})

Source from the content-addressed store, hash-verified

126}
127
128export function buildStandardLogEmbed({
129 color,
130 title,
131 description,
132 thumbnail,
133 image,
134 inlineFields = [],
135 fields = [],
136 author = null,
137 timestamp = true,
138 footer,
139}) {
140 const embed = new EmbedBuilder().setColor(color);
141
142 if (title) embed.setTitle(title.slice(0, 256));
143 if (description) embed.setDescription(description);
144 if (thumbnail) embed.setThumbnail(thumbnail);
145 if (image) embed.setImage(image);
146 if (author?.name) {
147 embed.setAuthor({
148 name: author.name.slice(0, 256),
149 iconURL: author.iconURL || undefined,
150 });
151 }
152
153 const combinedFields = [...inlineFields, ...fields];
154 if (combinedFields.length > 0) {
155 embed.addFields(
156 combinedFields.map((field) => ({
157 name: field.name.slice(0, 256),
158 value: String(field.value).slice(0, 1024),
159 inline: field.inline === true,
160 }))
161 );
162 }
163
164 if (timestamp) embed.setTimestamp();
165
166 if (footer?.text) {
167 embed.setFooter({
168 text: footer.text.slice(0, 2048),
169 iconURL: footer.iconURL || undefined,
170 });
171 }
172
173 return embed;
174}
175
176const MAX_DISPLAYED_ROLE_PERMISSIONS = 5;
177

Callers 3

createTicketLogEmbedFunction · 0.90
createLogEmbedFunction · 0.90
deleteTicketFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected