Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Starboard] Separate blocked/allowed roles and channels #528

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cogs/starboard/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ async def _update_stars(
return
allowed = starboard.check_roles(member)
allowed |= starboard.check_channel(self.bot, channel)
# temp-fix https://github.com/TrustyJAID/Trusty-cogs/issues/269
allowed = starboard.check_roles(member) and starboard.check_channel(self.bot, channel)
# temp-fix end
if not allowed:
log.debug("User or channel not in allowlist")
return
Expand Down
24 changes: 24 additions & 0 deletions cogs/starboard/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ async def format_page(self, menu: menus.MenuPages, starboard: StarboardEntry) ->
stars_added=starboard.stars_added,
selfstar=starboard.selfstar,
)
# temp-fix https://github.com/TrustyJAID/Trusty-cogs/issues/269
"""
if starboard.blacklist:
channels = [guild.get_channel(c) for c in starboard.blacklist]
roles = [guild.get_role(r) for r in starboard.blacklist]
Expand All @@ -64,6 +66,28 @@ async def format_page(self, menu: menus.MenuPages, starboard: StarboardEntry) ->
msg += _("Allowed Channels: {chans}\n").format(chans=chans)
if roles_str:
msg += _("Allowed roles: {roles}\n").format(roles=roles_str)
"""
if starboard.blacklist_role_ids:
roles = [guild.get_role(r) for r in starboard.blacklist_role_ids]
if roles:
roles_str = humanize_list([r.mention for r in roles if r is not None])
msg += _("Blocked roles: {roles}\n").format(roles=roles_str)
if starboard.blacklist_channel_ids:
channels = [guild.get_channel(c) for c in starboard.blacklist_channel_ids]
if channels:
channels_str = humanize_list([c.mention for c in channels if c is not None])
msg += _("Blocked channels: {channels}\n").format(channels=channels_str)
if starboard.whitelist_role_ids:
roles = [guild.get_role(r) for r in starboard.whitelist_role_ids]
if roles:
roles_str = humanize_list([r.mention for r in roles if r is not None])
msg += _("Allowed roles: {roles}\n").format(roles=roles_str)
if starboard.whitelist_channel_ids:
channels = [guild.get_channel(c) for c in starboard.whitelist_channel_ids]
if channels:
channels_str = humanize_list([c.mention for c in channels if c is not None])
msg += _("Allowed channels: {channels}\n").format(channels=channels_str)
# temp-fix end
count = 0
embed.description = ""
for page in pagify(msg, page_length=1024):
Expand Down
Loading