36 lines
1017 B
Python
Raw Normal View History

from discord.ext import commands
import discord
class Spam(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_message(self, message):
dump = {}
async for temp in message.channel.history(limit=5):
dump = dump + temp
if dump[1].created_at - dump[2].created_at <= 2:
if dump[2].created_at - dump[3].created_at <= 3:
if dump[3].created_at - dump[4].created_at <= 4:
await message.delete()
await self.client.process_commands(message)
def setup(client):
client.add_cog(Spam(client))
""" async for tempMessage in message.channel.history(limit=5):
if tempMessage.id == message.id:
pass
elif tempMessage.author == message.author:
difference = message.created_at - tempMessage.created_at
if difference.total_seconds() <= 2:
await message.delete()"""