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

Function getChannelConfiguration

src/services/joinToCreateService.js:421–448  ·  view source on GitHub ↗
(client, guildId, channelId)

Source from the content-addressed store, hash-verified

419}
420
421export async function getChannelConfiguration(client, guildId, channelId) {
422 try {
423 const config = await getConfiguration(client, guildId);
424
425 if (!config.triggerChannels || !Array.isArray(config.triggerChannels) || !config.triggerChannels.includes(channelId)) {
426 throw new TitanBotError(
427 'Channel is not a valid Join to Create trigger',
428 ErrorTypes.VALIDATION,
429 'This channel is not set up as a Join to Create trigger.'
430 );
431 }
432
433 return {
434 ...config,
435 channelConfig: config.channelOptions?.[channelId] || {}
436 };
437
438 } catch (error) {
439 if (error instanceof TitanBotError) {
440 throw error;
441 }
442 throw new TitanBotError(
443 `Failed to get channel configuration: ${error.message}`,
444 ErrorTypes.DATABASE,
445 'Failed to retrieve channel configuration. Please try again.'
446 );
447 }
448}
449
450export function hasManageGuildPermission(member) {
451 try {

Callers 1

handleConfigSubcommandFunction · 0.90

Calls 1

getConfigurationFunction · 0.85

Tested by

no test coverage detected