Skip to content

Commit

Permalink
Branch checking cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostopheles committed May 18, 2024
1 parent 2a4590b commit d1e1479
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions cogs/guild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def add_to_guild_watchlist(self, guild_id: int | str, branch: str):

if branch in watchlist:
return False, self.CONFIG.errors.BRANCH_ALREADY_IN_WATCHLIST
elif self.CONFIG.PRODUCTS.has_key(branch):
else:
if isinstance(watchlist, str):
watchlist = [watchlist, branch]
else:
Expand All @@ -175,8 +175,6 @@ def add_to_guild_watchlist(self, guild_id: int | str, branch: str):
guild_id, [*set(watchlist)], self.CONFIG.settings.WATCHLIST
)
return True, self.CONFIG.errors.OK
else:
return False, self.CONFIG.errors.ARG_BRANCH_NOT_VALID

def remove_from_guild_watchlist(self, guild_id: int | str, branch: str):
if not SUPPORTED_PRODUCTS.has_key(branch):
Expand All @@ -188,11 +186,9 @@ def remove_from_guild_watchlist(self, guild_id: int | str, branch: str):

watchlist = guild_config[self.CONFIG.settings.WATCHLIST.name]

if not self.CONFIG.PRODUCTS.has_key(branch):
return False, self.CONFIG.errors.ARG_BRANCH_NOT_VALID
elif branch not in watchlist:
if branch not in watchlist:
return False, self.CONFIG.errors.ARG_BRANCH_NOT_ON_WATCHLIST
elif self.CONFIG.PRODUCTS[branch]:
else:
if isinstance(watchlist, str):
return False, self.CONFIG.errors.WATCHLIST_CANNOT_BE_EMPTY
else:
Expand All @@ -202,11 +198,6 @@ def remove_from_guild_watchlist(self, guild_id: int | str, branch: str):
guild_id, [*set(watchlist)], self.CONFIG.settings.WATCHLIST
)
return True, self.CONFIG.errors.OK
else:
return (
False,
self.CONFIG.errors.ARG_BRANCH_NOT_VALID,
) # this should never happen?

def get_guild_watchlist(self, guild_id: int | str):
logger.debug(f"Grabbing guild watchlist for guild {guild_id}...")
Expand Down

0 comments on commit d1e1479

Please sign in to comment.