-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMsgMod.py
More file actions
40 lines (36 loc) · 1.62 KB
/
Copy pathMsgMod.py
File metadata and controls
40 lines (36 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import asyncio, discord, logging
from discord.ext import commands
class MsgModeration(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.guild_only()
@commands.has_permissions(manage_messages=True)
@commands.command(aliases=["purge"])
async def clear(self, ctx, number: int):
msg = "message"
if number != 1:
msg+='s'
amt = await ctx.channel.purge(limit = (int(number) + 1))
await asyncio.sleep(1)
clearConfirmation = await ctx.send(f"**Cleared `{len(amt) - 1}` {msg} from this channel**", delete_after=4.0)
await clearConfirmation.add_reaction("a:SpectrumOkSpin:466480898049835011")
@commands.guild_only()
@commands.has_permissions(manage_messages=True)
@commands.command(aliases=['slowmo'])
async def slowmode(self, ctx, seconds: int=0):
if seconds > 120:
return await ctx.send(":no_entry: Amount can't be over 120 seconds")
if seconds is 0:
await ctx.channel.edit(slowmode_delay=seconds)
a = await ctx.send("**Slowmode is off for this channel**")
await a.add_reaction("a:SpectrumOkSpin:466480898049835011")
else:
if seconds is 1:
numofsecs = "second"
else:
numofsecs = "seconds"
await ctx.channel.edit(slowmode_delay=seconds)
confirm = await ctx.send(f"**Set the channel slow mode delay to `{seconds}` {numofsecs}\nTo turn this off, do $slowmode**")
await confirm.add_reaction("a:SpectrumOkSpin:466480898049835011")
def setup(bot):
bot.add_cog(MsgModeration(bot))