Repository: tandemdude/hikari-lightbulb (language: python)

Issue:
check fails with admin permissions
### Steps to reproduce
The `has_guild_permissions` check is not passing when the command invoker has admin permissions

```py
@has_guild_permissions(hikari.Permissions.MANAGE_NICKNAMES)
@command()
async def command(ctx) -> None:
    pass
```

Invoke the command with admin permissions

### Expected Result
Check should have passed

### Actual Result
Check fails and raises `MissingRequiredPermission`

### System info
Most recent lightbulb dev version

### Checklist
- [x] I have made sure to remove ANY sensitive information (bot token, passwords,
      credentials, personal details, etc).
- [x] I have searched the issue tracker and have made sure it's not a duplicate.
      If it is a follow up of another issue, I have specified it.



Discussion / hints:
Same thing with `bot_has_guild_permissions`

Fix patch:
diff --git a/lightbulb/checks.py b/lightbulb/checks.py
index ca70b323..00478493 100644
--- a/lightbulb/checks.py
+++ b/lightbulb/checks.py
@@ -138,7 +138,9 @@ def _get_missing_perms(permissions: hikari.Permissions, roles: typing.Sequence[h
     for perm in permissions:
         if perm is hikari.Permissions.ADMINISTRATOR:
             return hikari.Permissions.NONE
-        if not any(role.permissions & perm for role in roles):
+
+        # Now it check if the role has admin. If it has admin, it doesn't count it as missing perm
+        if not any(role.permissions & perm or role.permissions & hikari.Permissions.ADMINISTRATOR for role in roles):
             missing_perms |= perm
     return missing_perms
 
@@ -150,6 +152,11 @@ async def _has_guild_permissions(ctx: context.Context, *, permissions: hikari.Pe
     await _guild_only(ctx)
 
     roles = ctx.bot.cache.get_roles_view_for_guild(ctx.guild_id).values()
+
+    # Checks if the author is the server owner
+    if ctx.guild.owner_id == ctx.author.id:
+        return True
+
     missing_perms = _get_missing_perms(permissions, [role for role in roles if role.id in ctx.member.role_ids])
 
     if missing_perms:


Test patch:
diff --git a/tests/test_checks.py b/tests/test_checks.py
index 5ea00ce0..08bf1d1a 100644
--- a/tests/test_checks.py
+++ b/tests/test_checks.py
@@ -18,6 +18,8 @@
 import mock
 import pytest
 from hikari import messages
+from hikari import Permissions
+from hikari import Intents
 
 from lightbulb import checks
 from lightbulb import context
@@ -83,6 +85,14 @@ async def test_owner_only_fails(ctx):
     assert exc_info.type is errors.NotOwner
 
 
+@pytest.mark.asyncio
+async def test_guild_owner_passes(ctx):
+    ctx.author.id = 12345
+    ctx.guild.owner_id = 12345
+    ctx.bot.intents = Intents.GUILDS
+    assert await checks._has_guild_permissions(ctx, permissions=[Permissions.ADMINISTRATOR])
+
+
 def test_add_check_called_with_guild_only():
     deco = checks.guild_only()
     fake_command = deco(mock.Mock(spec_set=commands.Command))