This issue is migrated from discussions in Discord
/cc @glynnw
We're searching for the audit channel before checking if audit transparency is enabled. This has two flaws:
- when the value is not provided, it errors despite never needing to perform the search
- this is inefficient
We could take advantage of && short-circuiting, but this would require an assignment to stay efficient. Assignments inside ifs are scary for those who aren't experienced with C-based languages; as they look like equality. In addition, it's again hard to tell if it's intentional. On the other hand, this leaves the code compact.
As an alternative, we could add something like
if(!config.auditTransparency) return;
This is more explicit, but also makes the code longer.
Consensus seems to be with the latter solution.
The bot should also
- crash
- with a really explicit error message
if you try to set up audit transparency with a channel doesn't exist.
It should do the former but not the latter. It should say something like 'Value must not be undefined' -- but we should state what should be set.
In addition, would it be a good idea to make it clear to users that the bot is being transparent/not. This would rely on non-technical users of the bot not knowing how to modify e.g. the 'Playing' field, and then using it to display 'transparent'/'not transparent'. I think this is a bad idea as it could create a false level of trust to this forgeable field.