Skip to content

Commit

Permalink
cogs.admin: Add slowmode command
Browse files Browse the repository at this point in the history
Add the ability to edit a channel's slowmode delay.
  • Loading branch information
RytoEX committed Sep 8, 2021
1 parent 3e25e78 commit a07176b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions obsbot/cogs/public/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, bot):
('.status', 'prints the bot\'s current status'),
('.setgame', 'Set the bot\'s "Playing ..." status'),
('.setsong', 'Set the bot\'s "Listening to ..." status'),
('.slow', 'Set the current channel\'s Slowmode setting, specified in seconds of delay'),
]
}
self.restricted = set()
Expand Down Expand Up @@ -102,6 +103,16 @@ def add_help_section(self, section_name, command_list, restricted=False):
if restricted:
self.restricted.add(section_name)

@command()
async def slow(self, ctx: Context, seconds: int=0):
if not self.bot.is_admin(ctx.author):
return

await ctx.channel.edit(slowmode_delay=seconds)
if seconds == 0:
await ctx.send(f"Slowmode has been disabled in this channel.")
elif seconds > 0:
await ctx.send(f"Slowmode has been enabled in this channel with a {seconds} second delay.")

def setup(bot):
bot.add_cog(Admin(bot))

0 comments on commit a07176b

Please sign in to comment.