File size: 509 Bytes
5dd5b6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import functools
from discord.ext import commands
import discord
import asyncio


def auto_delete(delay=5):
    def decorator(func):
        @functools.wraps(func)
        async def wrapper(self, ctx: commands.Context, *args, **kwargs):
            await func(self, ctx, *args, **kwargs)
            await asyncio.sleep(delay)
            try:
                await ctx.message.delete()
            except Exception as e:
                pass

        return wrapper

    return decorator