(client, guildId, channelId)
| 419 | } |
| 420 | |
| 421 | export 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 | |
| 450 | export function hasManageGuildPermission(member) { |
| 451 | try { |
no test coverage detected