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

Function setLogChannel

src/services/loggingService.js:395–417  ·  view source on GitHub ↗
(client, guildId, destination, channelId)

Source from the content-addressed store, hash-verified

393}
394
395export async function setLogChannel(client, guildId, destination, channelId) {
396 if (!LOG_DESTINATIONS.includes(destination)) {
397 throw new Error(`Invalid log destination: ${destination}`);
398 }
399
400 try {
401 const config = await getGuildConfig(client, guildId);
402 const logging = {
403 ...config.logging,
404 channels: { ...(config.logging?.channels || {}), [destination]: channelId },
405 };
406
407 if (channelId) {
408 logging.enabled = true;
409 }
410
411 await updateGuildConfig(client, guildId, { logging });
412 return true;
413 } catch (error) {
414 logger.error('Error setting log channel:', error);
415 return false;
416 }
417}
418
419/** @deprecated Use setLogChannel(client, guildId, 'audit', channelId) */
420export async function setLoggingChannel(client, guildId, channelId) {

Callers 6

handleLogChannelFunction · 0.90
executeFunction · 0.90
executeFunction · 0.90
showChannelModalFunction · 0.90
handleLoggingMenuSelectFunction · 0.90
setLoggingChannelFunction · 0.85

Calls 1

getGuildConfigFunction · 0.90

Tested by

no test coverage detected