(client, guildId, { action, type, id })
| 434 | } |
| 435 | |
| 436 | export async function updateIgnoreList(client, guildId, { action, type, id }) { |
| 437 | try { |
| 438 | const config = await getGuildConfig(client, guildId); |
| 439 | const ignore = { ...getIgnoreList(config) }; |
| 440 | const listKey = type === 'user' ? 'users' : 'channels'; |
| 441 | const current = [...(ignore[listKey] || [])]; |
| 442 | |
| 443 | if (action === 'add' && !current.includes(id)) { |
| 444 | current.push(id); |
| 445 | } else if (action === 'remove') { |
| 446 | const index = current.indexOf(id); |
| 447 | if (index !== -1) { |
| 448 | current.splice(index, 1); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | ignore[listKey] = current; |
| 453 | |
| 454 | const logging = { ...config.logging, ignore }; |
| 455 | await updateGuildConfig(client, guildId, { logging }); |
| 456 | return true; |
| 457 | } catch (error) { |
| 458 | logger.error('Error updating ignore list:', error); |
| 459 | return false; |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | export function resolveApplicationLogChannel(config, roleSettings = {}, appSettings = {}) { |
| 464 | return roleSettings.logChannelId |
no test coverage detected