Skip to content

Commit

Permalink
fix: simplify is_team_member_or_owner
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalk0 committed Feb 22, 2024
1 parent 756856b commit 0120e15
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ def __init__(self):
# Declare command tree
self.tree = discord.app_commands.CommandTree(self)

# Variable for storing owners id
# If set manually, it will not fetch from the bot's application info
self.owners = []

# Used to check the first time the bot does the on_ready event
self.first = True

Expand Down Expand Up @@ -115,13 +111,10 @@ async def on_message(self, message: discord.Message):
self.bot_logger.info(f'{self.user} responded to {author}: "{response[0]}"')

async def is_team_member_or_owner(self, author: discord.User) -> bool:
if not self.owners:
app_info = await self.application_info()
if app_info.team:
self.owners = [member.id for member in app_info.team.members]
else:
self.owners = [app_info.owner.id]
return author.id in self.owners
if self.application.team:
return author.id in self.application.team.members
else:
return author.id == self.application.owner.id

# Add a basic HTTP server to check if the bot is up
async def start_server(self):
Expand Down

0 comments on commit 0120e15

Please sign in to comment.