The current authentication layer is an absolute mess. This proposal introduces the following format:
enum CommandAuthMethod {
Role,
Permission
}
interface CommandAuthOptions {
method: CommandAuthMethod;
values: PermissionResolvable[] | RoleResolvable[];
}
Now, the current architecture assumes that the guild has the milestones, and uses this weird ass logic that I wrote which is not easily comprehensible and doesn't have comments explaining it:
if (
role.id === requiredRole ||
(indexOfMemberRole > -1 && indexOfMemberRole <= indexOfRequiredRole)
)
return true;
So, instead of this, either:
- explicitly define that the bot has levels and require the level controller as a dependency, then use a utility that checks levels
- remove level-based command authorization altogether
By the looks of it, there's not a single command that uses levels for authorization. There was some in the past, but these were removed/replaced. Removing it entirely seems the better option.
Update: After discussion, we've settled on entirely removing it. The logic should also completely remove the auth role type AUTH_VERIFIED since discord handles it on its own now for opted-in servers.
The current authentication layer is an absolute mess. This proposal introduces the following format:
Now, the current architecture assumes that the guild has the milestones, and uses this weird ass logic that I wrote which is not easily comprehensible and doesn't have comments explaining it:
So, instead of this, either:
By the looks of it, there's not a single command that uses levels for authorization. There was some in the past, but these were removed/replaced. Removing it entirely seems the better option.
Update: After discussion, we've settled on entirely removing it. The logic should also completely remove the auth role type
AUTH_VERIFIEDsince discord handles it on its own now for opted-in servers.