Skip to content

Commit

Permalink
Fixed admin key retrieval for slash commands not sent in a server
Browse files Browse the repository at this point in the history
Signed-off-by: tiksan <[email protected]>
  • Loading branch information
dssecret committed Feb 8, 2025
1 parent abe6dde commit 697f15b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions application/skynet/skyutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ def get_admin_keys(interaction, all_keys: bool = False) -> tuple:
invoker = User.select(User.tid).where(User.discord_id == interaction["member"]["user"]["id"]).get()
else:
invoker = User.select(User.tid).where(User.discord_id == interaction["user"]["id"]).get()

admin_keys.append(invoker.key)
except DoesNotExist:
invoker = None

if invoker is not None and not all_keys and invoker.key is not None:
return tuple([invoker.key])
if invoker is not None and not all_keys:
return tuple(admin_keys)
elif "guild_id" not in interaction:
return tuple(admin_keys)

if "guild_id" in interaction:
try:
Expand Down

0 comments on commit 697f15b

Please sign in to comment.