Skip to content

Commit 2262eaa

Browse files
committed
Add slowmode command
Add the ability to edit a channel's slowmode delay.
1 parent 3e25e78 commit 2262eaa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

obsbot/cogs/public/admin.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, bot):
1818
('.status', 'prints the bot\'s current status'),
1919
('.setgame', 'Set the bot\'s "Playing ..." status'),
2020
('.setsong', 'Set the bot\'s "Listening to ..." status'),
21+
('.slow', 'Set the current channel\'s Slowmode setting, specified in seconds of delay'),
2122
]
2223
}
2324
self.restricted = set()
@@ -102,6 +103,16 @@ def add_help_section(self, section_name, command_list, restricted=False):
102103
if restricted:
103104
self.restricted.add(section_name)
104105

106+
@command()
107+
async def slow(self, ctx: Context, seconds: int=0):
108+
if not self.bot.is_admin(ctx.author):
109+
return
110+
111+
await ctx.channel.edit(slowmode_delay=seconds)
112+
if seconds == 0:
113+
await ctx.send(f"Slowmode has been disabled in this channel.")
114+
elif seconds > 0:
115+
await ctx.send(f"Slowmode has been enabled in this channel with a {seconds} second delay.")
105116

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

0 commit comments

Comments
 (0)