Skip to content

Commit aa3fc2d

Browse files
committed
Remove uses of Roles.partners and rename constants
1 parent 77b5290 commit aa3fc2d

File tree

13 files changed

+34
-35
lines changed

13 files changed

+34
-35
lines changed

bot/constants.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class _Roles(EnvConfig, env_prefix="roles_"):
143143
archived_channels_access: int = 1074780483776417964
144144

145145
contributors: int = 295488872404484098
146-
partners: int = 323426753857191936
147146
python_community: int = 458226413825294336
148147
voice_verified: int = 764802720779337729
149148

@@ -604,7 +603,7 @@ class _Keys(EnvConfig, env_prefix="api_keys_"):
604603
# Default role combinations
605604
MODERATION_ROLES = Guild.moderation_roles
606605
STAFF_ROLES = Guild.staff_roles
607-
STAFF_PARTNERS_COMMUNITY_ROLES = STAFF_ROLES + (Roles.partners, Roles.python_community)
606+
STAFF_AND_COMMUNITY_ROLES = STAFF_ROLES + (Roles.python_community,)
608607

609608
# Channel combinations
610609
MODERATION_CHANNELS = Guild.moderation_channels

bot/exts/info/help.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from rapidfuzz.utils import default_process
1010

1111
from bot import constants
12-
from bot.constants import Channels, STAFF_PARTNERS_COMMUNITY_ROLES
12+
from bot.constants import Channels, STAFF_AND_COMMUNITY_ROLES
1313
from bot.decorators import redirect_output
1414
from bot.log import get_logger
1515
from bot.pagination import LinePaginator
@@ -176,7 +176,7 @@ class CustomHelpCommand(HelpCommand):
176176
def __init__(self):
177177
super().__init__(command_attrs={"help": "Shows help for bot commands"})
178178

179-
@redirect_output(destination_channel=Channels.bot_commands, bypass_roles=STAFF_PARTNERS_COMMUNITY_ROLES)
179+
@redirect_output(destination_channel=Channels.bot_commands, bypass_roles=STAFF_AND_COMMUNITY_ROLES)
180180
async def command_callback(self, ctx: Context, *, command: str | None = None) -> None:
181181
"""Attempts to match the provided query with a valid command or cog."""
182182
# the only reason we need to tamper with this is because d.py does not support "categories",

bot/exts/info/information.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async def get_extended_server_info(self, ctx: Context) -> str:
117117
{python_general.mention} cooldown: {python_general.slowmode_delay}s
118118
""")
119119

120-
@has_any_role(*constants.STAFF_PARTNERS_COMMUNITY_ROLES)
120+
@has_any_role(*constants.STAFF_AND_COMMUNITY_ROLES)
121121
@command(name="roles")
122122
async def roles_info(self, ctx: Context) -> None:
123123
"""Returns a list of all roles and their corresponding IDs."""
@@ -137,7 +137,7 @@ async def roles_info(self, ctx: Context) -> None:
137137

138138
await LinePaginator.paginate(role_list, ctx, embed, empty=False)
139139

140-
@has_any_role(*constants.STAFF_PARTNERS_COMMUNITY_ROLES)
140+
@has_any_role(*constants.STAFF_AND_COMMUNITY_ROLES)
141141
@command(name="role")
142142
async def role_info(self, ctx: Context, *roles: Role | str) -> None:
143143
"""
@@ -258,7 +258,7 @@ async def user_info(self, ctx: Context, user_or_message: MemberOrUser | Message
258258
return
259259

260260
# Will redirect to #bot-commands if it fails.
261-
if in_whitelist_check(ctx, roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES):
261+
if in_whitelist_check(ctx, roles=constants.STAFF_AND_COMMUNITY_ROLES):
262262
embed = await self.create_user_embed(ctx, user, passed_as_message)
263263
await ctx.send(embed=embed)
264264

@@ -562,9 +562,9 @@ def add_content(title: str, content: str) -> None:
562562

563563
await ctx.send(message)
564564

565-
@cooldown_with_role_bypass(2, 60 * 3, BucketType.member, bypass_roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
565+
@cooldown_with_role_bypass(2, 60 * 3, BucketType.member, bypass_roles=constants.STAFF_AND_COMMUNITY_ROLES)
566566
@group(invoke_without_command=True)
567-
@in_whitelist(channels=(constants.Channels.bot_commands,), roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
567+
@in_whitelist(channels=(constants.Channels.bot_commands,), roles=constants.STAFF_AND_COMMUNITY_ROLES)
568568
async def raw(self, ctx: Context, message: Message | None = None) -> None:
569569
"""Shows information about the raw API response."""
570570
if message is None:

bot/exts/info/patreon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from bot import constants
99
from bot.bot import Bot
10-
from bot.constants import Channels, Guild, Roles, STAFF_PARTNERS_COMMUNITY_ROLES
10+
from bot.constants import Channels, Guild, Roles, STAFF_AND_COMMUNITY_ROLES
1111
from bot.decorators import in_whitelist
1212
from bot.log import get_logger
1313

@@ -110,7 +110,7 @@ async def patreon_info(self, ctx: commands.Context) -> None:
110110
await ctx.send(embed=embed)
111111

112112
@patreon_info.command("supporters", aliases=("patrons",))
113-
@in_whitelist(channels=(Channels.bot_commands,), roles=STAFF_PARTNERS_COMMUNITY_ROLES)
113+
@in_whitelist(channels=(Channels.bot_commands,), roles=STAFF_AND_COMMUNITY_ROLES)
114114
async def patreon_supporters(self, ctx: commands.Context) -> None:
115115
"""Sends the current list of patreon supporters, sorted by tier level."""
116116
await self.send_current_supporters(ctx.channel)

bot/exts/info/subscribe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ async def cog_load(self) -> None:
184184
@commands.command(name="subscribe", aliases=("unsubscribe",))
185185
@redirect_output(
186186
destination_channel=constants.Channels.bot_commands,
187-
bypass_roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES,
187+
bypass_roles=constants.STAFF_AND_COMMUNITY_ROLES,
188188
)
189189
async def subscribe_command(self, ctx: commands.Context, *_) -> None: # We don't actually care about the args
190190
"""Display the member's current state for each role, and allow them to add/remove the roles."""

bot/exts/moderation/infraction/_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pydis_core.site_api import ResponseCodeError
1010

1111
import bot
12-
from bot.constants import Categories, Channels, Colours, Icons, MODERATION_ROLES, STAFF_PARTNERS_COMMUNITY_ROLES
12+
from bot.constants import Categories, Channels, Colours, Icons, MODERATION_ROLES, STAFF_AND_COMMUNITY_ROLES
1313
from bot.converters import DurationOrExpiry, MemberOrUser
1414
from bot.errors import InvalidInfractedUserError
1515
from bot.exts.moderation.infraction._views import BanConfirmationView
@@ -332,11 +332,11 @@ async def confirm_elevated_user_ban(ctx: Context, user: MemberOrUser) -> bool:
332332
"""
333333
If user has an elevated role, require confirmation before banning.
334334
335-
A member with the staff, partner, or community roles are considered elevated.
335+
A member with the staff or community roles are considered elevated.
336336
337337
Returns a boolean indicating whether the infraction should proceed.
338338
"""
339-
if not isinstance(user, Member) or not any(role.id in STAFF_PARTNERS_COMMUNITY_ROLES for role in user.roles):
339+
if not isinstance(user, Member) or not any(role.id in STAFF_AND_COMMUNITY_ROLES for role in user.roles):
340340
return True
341341

342342
confirmation_view = BanConfirmationView(

bot/exts/moderation/stream.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Guild,
1717
MODERATION_ROLES,
1818
Roles,
19-
STAFF_PARTNERS_COMMUNITY_ROLES,
19+
STAFF_AND_COMMUNITY_ROLES,
2020
VideoPermission,
2121
)
2222
from bot.converters import Expiry
@@ -199,17 +199,17 @@ async def revokestream(self, ctx: commands.Context, member: discord.Member) -> N
199199
@commands.command(aliases=("lstream",))
200200
@commands.has_any_role(*MODERATION_ROLES)
201201
async def liststream(self, ctx: commands.Context) -> None:
202-
"""Lists all users who aren't staff, partners or members of the python community and have stream permissions."""
203-
non_staff_partners_community_members_with_stream = [
202+
"""Lists all users who aren't staff or members of the python community and have stream permissions."""
203+
non_staff_or_community_members_with_stream = [
204204
member
205205
for member in ctx.guild.get_role(Roles.video).members
206-
if not any(role.id in STAFF_PARTNERS_COMMUNITY_ROLES for role in member.roles)
206+
if not any(role.id in STAFF_AND_COMMUNITY_ROLES for role in member.roles)
207207
]
208208

209209
# List of tuples (UtcPosixTimestamp, str)
210210
# So that the list can be sorted on the UtcPosixTimestamp before the message is passed to the paginator.
211211
streamer_info = []
212-
for member in non_staff_partners_community_members_with_stream:
212+
for member in non_staff_or_community_members_with_stream:
213213
if revoke_time := await self.task_cache.get(member.id):
214214
# Member only has temporary streaming perms
215215
revoke_delta = Arrow.utcfromtimestamp(revoke_time).humanize()

bot/exts/utils/ping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from discord.ext import commands
55

66
from bot.bot import Bot
7-
from bot.constants import Channels, STAFF_PARTNERS_COMMUNITY_ROLES, URLs
7+
from bot.constants import Channels, STAFF_AND_COMMUNITY_ROLES, URLs
88
from bot.decorators import in_whitelist
99

1010
DESCRIPTIONS = (
@@ -22,7 +22,7 @@ def __init__(self, bot: Bot) -> None:
2222
self.bot = bot
2323

2424
@commands.command()
25-
@in_whitelist(channels=(Channels.bot_commands,), roles=STAFF_PARTNERS_COMMUNITY_ROLES)
25+
@in_whitelist(channels=(Channels.bot_commands,), roles=STAFF_AND_COMMUNITY_ROLES)
2626
async def ping(self, ctx: commands.Context) -> None:
2727
"""
2828
Gets different measures of latency within the bot.

bot/exts/utils/reminders.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
NEGATIVE_REPLIES,
2323
POSITIVE_REPLIES,
2424
Roles,
25-
STAFF_PARTNERS_COMMUNITY_ROLES,
25+
STAFF_AND_COMMUNITY_ROLES,
2626
)
2727
from bot.converters import Duration, UnambiguousUser
2828
from bot.errors import LockedResourceError
@@ -288,7 +288,7 @@ async def _check_mentions(ctx: Context, mentions: t.Iterable[Mentionable]) -> tu
288288
289289
If mentions aren't allowed, also return the type of mention(s) disallowed.
290290
"""
291-
if await has_no_roles_check(ctx, *STAFF_PARTNERS_COMMUNITY_ROLES):
291+
if await has_no_roles_check(ctx, *STAFF_AND_COMMUNITY_ROLES):
292292
return False, "members/roles"
293293
if await has_no_roles_check(ctx, *MODERATION_ROLES):
294294
return all(isinstance(mention, discord.User | discord.Member) for mention in mentions), "roles"
@@ -455,9 +455,9 @@ async def new_reminder(
455455
456456
For example, to set a reminder that expires in 3 days and 1 minute, you can do `!remind new 3d1M Do something`.
457457
"""
458-
# If the user is not staff, partner or part of the python community,
458+
# If the user is not staff or part of the python community,
459459
# we need to verify whether or not to make a reminder at all.
460-
if await has_no_roles_check(ctx, *STAFF_PARTNERS_COMMUNITY_ROLES):
460+
if await has_no_roles_check(ctx, *STAFF_AND_COMMUNITY_ROLES):
461461

462462
# If they don't have permission to set a reminder in this channel
463463
if ctx.channel.id not in WHITELISTED_CHANNELS:

bot/exts/utils/snekbox/_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# The Snekbox commands' whitelists and blacklists.
1515
NO_SNEKBOX_CHANNELS = (Channels.python_general,)
1616
NO_SNEKBOX_CATEGORIES = ()
17-
SNEKBOX_ROLES = (Roles.helpers, Roles.moderators, Roles.admins, Roles.owners, Roles.python_community, Roles.partners)
17+
SNEKBOX_ROLES = (Roles.helpers, Roles.moderators, Roles.admins, Roles.owners, Roles.python_community)
1818

1919
REDO_EMOJI = "\U0001f501" # :repeat:
2020
REDO_TIMEOUT = 30

0 commit comments

Comments
 (0)