Skip to content

Better auth declaration #187

Description

@KL13NT

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrfcA dicussion

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions