-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpurge.py
33 lines (25 loc) · 1.13 KB
/
purge.py
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
import discord
from discord.ext import commands
from discord.ext.commands.core import command
class Example(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(pass_context=True)
@commands.has_permissions(manage_messages=True)
async def purge(self, ctx, amount =1):
await ctx.channel.purge(limit=amount+1)
await ctx.send('Context removed sir! {}'.format(ctx.author.mention), delete_after=2)
await ctx.message.delete()
@purge.error
async def clear_error(self, ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.channel.purge(limit=1)
await ctx.send("You do not have permission to do so {}".format(ctx.author.mention), delete_after=3)
def is_it_liege(ctx):
return ctx.author.id == 328131534894661634
@commands.command()
@commands.check(is_it_liege)
async def respect(self, ctx):
await ctx.send(f"It is an **Honour** to serve you **Legion Commander** {ctx.author.mention}")
def setup(client):
client.add_cog(Example(client))