roleme: fix missing filters
This commit is contained in:
		
							parent
							
								
									9f6d2e95ed
								
							
						
					
					
						commit
						373ad3e604
					
				
					 1 changed files with 24 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -125,10 +125,13 @@ roleme.callback = async function (msg, line, args) {
 | 
			
		|||
        return "I do not have `Manage Roles` permission.";
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, argStr);
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, argStr, (role) =>
 | 
			
		||||
        roles.includes(role.id)
 | 
			
		||||
      );
 | 
			
		||||
      if (role === "No results") return role;
 | 
			
		||||
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
      if (!roles.includes(role.id)) {
 | 
			
		||||
        return "Role not in assignable roles.";
 | 
			
		||||
      } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -161,10 +164,13 @@ roleme.callback = async function (msg, line, args) {
 | 
			
		|||
        return "I do not have `Manage Roles` permission.";
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, argStr);
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, argStr, (role) =>
 | 
			
		||||
        roles.includes(role.id)
 | 
			
		||||
      );
 | 
			
		||||
      if (role === "No results") return role;
 | 
			
		||||
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
      if (!roles.includes(role.id)) {
 | 
			
		||||
        return "Role not in assignable roles.";
 | 
			
		||||
      } else if (msg.member.roles.includes(role.id)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -179,10 +185,15 @@ roleme.callback = async function (msg, line, args) {
 | 
			
		|||
        return "I do not have `Manage Roles` permission.";
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, argStr);
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(
 | 
			
		||||
        msg,
 | 
			
		||||
        argStr,
 | 
			
		||||
        (role) => roles.includes(role.id) && msg.member.roles.includes(role.id)
 | 
			
		||||
      );
 | 
			
		||||
      if (role === "No results") return role;
 | 
			
		||||
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
      if (!roles.includes(role.id)) {
 | 
			
		||||
        return "Role not in assignable roles.";
 | 
			
		||||
      } else if (!msg.member.roles.includes(role.id)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -207,10 +218,15 @@ roleme.callback = async function (msg, line, args) {
 | 
			
		|||
        return "I do not have `Manage Roles` permission.";
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(msg, (subcommand + " " + argStr).trim());
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
 | 
			
		||||
      const role = await lookupRole(
 | 
			
		||||
        msg,
 | 
			
		||||
        (subcommand + " " + argStr).trim(),
 | 
			
		||||
        (role) => roles.includes(role.id)
 | 
			
		||||
      );
 | 
			
		||||
      if (role === "No results") return role;
 | 
			
		||||
 | 
			
		||||
      const roles = await getRoles(msg.guildID);
 | 
			
		||||
      if (!roles.includes(role.id)) return "Role not in assignable roles.";
 | 
			
		||||
 | 
			
		||||
      if (msg.member.roles.includes(role.id)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue