Skip to content

Commit

Permalink
Add permstream command
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenChen committed Aug 21, 2024
1 parent 7faf887 commit d59c86e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
38 changes: 29 additions & 9 deletions cogs/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion kurisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions utils/userlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit d59c86e

Please sign in to comment.