MCPcopy
hub / github.com/codebymitch/TitanBot / handleReview

Function handleReview

src/commands/Community/app-admin.js:273–481  ·  view source on GitHub ↗
(interaction)

Source from the content-addressed store, hash-verified

271}
272
273async function handleReview(interaction) {
274 const appId = interaction.options.getString("id");
275
276 const application = await getApplication(
277 interaction.client,
278 interaction.guild.id,
279 appId,
280 );
281 if (!application) {
282 return await replyUserError(interaction, { type: ErrorTypes.USER_INPUT, message: 'Application not found.' });
283 }
284
285 if (application.status !== "pending") {
286 return await replyUserError(interaction, { type: ErrorTypes.UNKNOWN, message: 'This application has already been processed.' });
287 }
288
289 const appEmbed = createEmbed({
290 title: `Review Application`,
291 description: `**User:** <@${application.userId}>\n**Application:** ${application.roleName}\n**Application ID:** \`${appId}\``,
292 color: 'info',
293 });
294
295 if (application.answers && application.answers.length > 0) {
296 application.answers.forEach((item, index) => {
297 appEmbed.addFields({
298 name: `Q${index + 1}: ${item.question}`,
299 value: item.answer || '*No answer provided*',
300 inline: false
301 });
302 });
303 }
304
305 const buttonRow = new ActionRowBuilder().addComponents(
306 new ButtonBuilder()
307 .setCustomId(`app_review_approve_${appId}`)
308 .setLabel('Approve')
309 .setStyle(ButtonStyle.Success),
310 new ButtonBuilder()
311 .setCustomId(`app_review_deny_${appId}`)
312 .setLabel('Deny')
313 .setStyle(ButtonStyle.Danger),
314 );
315
316 await InteractionHelper.safeEditReply(interaction, {
317 embeds: [appEmbed],
318 components: [buttonRow],
319 flags: ["Ephemeral"],
320 });
321
322 const collector = interaction.channel.createMessageComponentCollector({
323 componentType: ComponentType.Button,
324 filter: i =>
325 i.user.id === interaction.user.id &&
326 (i.customId.startsWith(`app_review_approve_${appId}`) ||
327 i.customId.startsWith(`app_review_deny_${appId}`)),
328 time: 300_000,
329 max: 1,
330 });

Callers 1

app-admin.jsFile · 0.85

Calls 10

getApplicationFunction · 0.90
createEmbedFunction · 0.90
getColorFunction · 0.90
successEmbedFunction · 0.90
replyUserErrorFunction · 0.85
safeEditReplyMethod · 0.80
reviewApplicationMethod · 0.80
editMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected