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

Function execute

src/commands/Utility/modules/report_setchannel.js:8–30  ·  view source on GitHub ↗
(interaction, config, client)

Source from the content-addressed store, hash-verified

6
7export default {
8 async execute(interaction, config, client) {
9 if (!interaction.member.permissions.has(PermissionsBitField.Flags.ManageGuild)) {
10 return await replyUserError(interaction, { type: ErrorTypes.PERMISSION, message: 'You need **Manage Server** permissions to set the report channel.' });
11 }
12
13 const channel = interaction.options.getChannel('channel');
14 const guildId = interaction.guildId;
15
16 try {
17 await setLogChannel(client, guildId, 'reports', channel.id);
18
19 return InteractionHelper.safeReply(interaction, {
20 embeds: [successEmbed(
21 'Report Channel Set',
22 `All new reports will now be sent to ${channel}.\nYou can also manage this from \`/logging dashboard\`.`,
23 )],
24 ephemeral: true,
25 });
26 } catch (error) {
27 logger.error('report_setchannel error:', error);
28 return await replyUserError(interaction, { type: ErrorTypes.UNKNOWN, message: 'Could not save the channel configuration.' });
29 }
30 },
31};

Callers

nothing calls this directly

Calls 4

setLogChannelFunction · 0.90
successEmbedFunction · 0.90
replyUserErrorFunction · 0.85
safeReplyMethod · 0.80

Tested by

no test coverage detected