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

Function buildRoleAuditFields

src/utils/logEmbeds.js:178–236  ·  view source on GitHub ↗
(role, { includeMemberCount = false } = {})

Source from the content-addressed store, hash-verified

176const MAX_DISPLAYED_ROLE_PERMISSIONS = 5;
177
178export function buildRoleAuditFields(role, { includeMemberCount = false } = {}) {
179 const fields = [
180 {
181 name: 'Role Name',
182 value: role.name,
183 inline: true
184 },
185 {
186 name: 'Color',
187 value: role.hexColor || '#000000',
188 inline: true
189 },
190 {
191 name: 'Role ID',
192 value: role.id,
193 inline: true
194 }
195 ];
196
197 const permissions = role.permissions.toArray();
198 if (permissions.length > 0) {
199 const displayPerms = permissions.slice(0, MAX_DISPLAYED_ROLE_PERMISSIONS).join(',');
200 fields.push({
201 name: 'Permissions',
202 value: permissions.length > MAX_DISPLAYED_ROLE_PERMISSIONS
203 ? `${displayPerms}... (+${permissions.length - MAX_DISPLAYED_ROLE_PERMISSIONS} more)`
204 : displayPerms,
205 inline: false
206 });
207 }
208
209 fields.push(
210 {
211 name: 'Hoisted',
212 value: role.hoist ? 'Yes' : 'No',
213 inline: true
214 },
215 {
216 name: 'Managed',
217 value: role.managed ? 'Yes (Bot role)' : 'No',
218 inline: true
219 },
220 {
221 name: 'Position',
222 value: role.position.toString(),
223 inline: true
224 }
225 );
226
227 if (includeMemberCount) {
228 fields.push({
229 name: 'Members with Role',
230 value: role.members.size.toString(),
231 inline: true
232 });
233 }
234
235 return fields;

Callers 1

buildRoleAuditLinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected