From d59c86e5529f264b961f825a6902f21874665109 Mon Sep 17 00:00:00 2001 From: FrozenChen Date: Wed, 21 Aug 2024 10:43:15 -0300 Subject: [PATCH] Add permstream command --- cogs/mod.py | 38 +++++++++++++++++++++++++++++--------- kurisu.py | 2 +- utils/userlog.py | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/cogs/mod.py b/cogs/mod.py index 726901540..3c879b0f2 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -851,25 +851,45 @@ async def tempstream(self, ctx: GuildContext, member: discord.Member, length: st msg_user = f"You have been given streaming permissions until {expiring_time_string}!" await send_dm_message(member, msg_user, ctx) await ctx.send(f"{member.mention} has been given streaming permissions until {expiring_time_string}.") - await self.logs.post_action_log(ctx.author, member, 'tempstream', reason=reason, until=expiring_time) + await self.logs.post_action_log(ctx.author, member, 'stream', reason=reason, until=expiring_time) @is_staff("OP") @commands.bot_has_permissions(manage_roles=True) @commands.guild_only() @commands.command() - async def notempstream(self, ctx: GuildContext, member: discord.Member, *, reason: Optional[str]): - """Revokes temporary streaming permissions from a member.""" + async def permstream(self, ctx: GuildContext, member: discord.Member, *, reason: Optional[str]): + """Gives permanent streaming permissions to a member.""" - role = self.bot.roles['streamer(temp)'] - await member.remove_roles(role) + role = self.bot.roles['streamer'] + temp_role = self.bot.roles['streamer(temp)'] + await member.add_roles(role) + await member.remove_roles(temp_role) - if self.extras.timed_roles.get((member.id, role.id)): - res = await self.extras.delete_timed_role(member.id, role.id) + if self.extras.timed_roles.get((member.id, temp_role.id)): + await self.extras.delete_timed_role(member.id, temp_role.id) + + msg_user = "You have been given permanent streaming permissions!" + await send_dm_message(member, msg_user, ctx) + await ctx.send(f"{member.mention} has been given permanent streaming permissions.") + await self.logs.post_action_log(ctx.author, member, 'stream', reason=reason) + + @is_staff("OP") + @commands.bot_has_permissions(manage_roles=True) + @commands.guild_only() + @commands.command() + async def nostream(self, ctx: GuildContext, member: discord.Member, *, reason: Optional[str]): + """Revokes permanent streaming permissions from a member.""" + + roles = (self.bot.roles['streamer'], self.bot.roles['streamer(temp)']) + await member.remove_roles(*roles) + + if self.extras.timed_roles.get((member.id, self.bot.roles['streamer(temp)'].id)): + res = await self.extras.delete_timed_role(member.id, self.bot.roles['streamer(temp)'].id) if not res: return await ctx.send("Failed to remove temporary role.") - msg_user = "Your temporary streaming permissions have been revoked!" + msg_user = "Your streaming permissions have been revoked!" await send_dm_message(member, msg_user, ctx) - await self.logs.post_action_log(ctx.author, member, 'no-tempstream', reason=reason) + await self.logs.post_action_log(ctx.author, member, 'no-stream', reason=reason) @is_staff("OP") @commands.guild_only() diff --git a/kurisu.py b/kurisu.py index 884f82be5..cc555e3c9 100644 --- a/kurisu.py +++ b/kurisu.py @@ -300,7 +300,7 @@ async def load_roles(self): roles = ['Helpers', 'Staff', 'HalfOP', 'OP', 'SuperOP', 'Owner', 'On-Duty 3DS', 'On-Duty Wii U', 'On-Duty Switch', 'On-Duty Legacy', 'On-Duty Wii', 'Probation', 'Retired Staff', 'Verified', 'Trusted', 'Muted', 'No-Help', 'No-elsewhere', 'No-Memes', 'No-art', 'No-animals', '#art-discussion', 'No-Embed', '#elsewhere', - 'Small Help', 'meta-mute', 'appeal-mute', 'crc', 'No-Tech', 'help-mute', 'streamer(temp)', '🍰', + 'Small Help', 'meta-mute', 'appeal-mute', 'crc', 'No-Tech', 'help-mute', 'streamer(temp)', 'streamer', '🍰', 'No-U', 'No-Wii'] for n in roles: diff --git a/utils/userlog.py b/utils/userlog.py index c94a5809b..b63058a12 100644 --- a/utils/userlog.py +++ b/utils/userlog.py @@ -50,8 +50,8 @@ 'probate': ('\N{NO ENTRY SIGN}', 'Probated', 'probated {}'), 'unprobate': ('\N{HEAVY LARGE CIRCLE}', 'Un-probated', 'un-probated {}'), - 'tempstream': ('\N{HEAVY LARGE CIRCLE}', 'Permission Granted', 'granted streaming permissions to {}'), - 'no-tempstream': ('\N{NO ENTRY SIGN}', 'Permission Revoked', 'revoked streaming permissions from {}'), + 'stream': ('\N{HEAVY LARGE CIRCLE}', 'Permission Granted', 'granted streaming permissions to {}'), + 'no-stream': ('\N{NO ENTRY SIGN}', 'Permission Revoked', 'revoked streaming permissions from {}'), 'take-memes': ('\N{NO ENTRY SIGN}', 'Permission Revoked', 'revoked meme permissions from {}'), 'nou': ('\N{NO ENTRY SIGN}', 'Sent to the void', 'sent {} to the void'),