started work on spam filter, broken do not pull

Signed-off-by: officereso <qrs01@snowtx.com>
This commit is contained in:
officereso 2019-08-01 16:59:54 -05:00
parent b8bd0d7daf
commit 5f945cef23
3 changed files with 42 additions and 4 deletions

View File

@ -20,9 +20,10 @@ class Join(commands.Cog):
@commands.Cog.listener()
async def on_member_join(self, member):
if member.id == 234703033924059138:
await self.client.get_channel(605932352736067589).send(member.mention +
", is most defiantly both a furry and a weeb. We should all bully him because he stinks."
)
await self.client.get_channel(605932352736067589).send(
member.mention +
", is most defiantly both a furry and a weeb. We should all bully him because he stinks."
)
else:
await self.client.get_channel(605932352736067589).send(member.mention + random.choice(content))
await member.add_roles(self.client.get_guild(605932352736067585).get_role(605934866676056070))

View File

@ -0,0 +1,36 @@
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()"""

3
bot.py
View File

@ -4,7 +4,7 @@
from discord.ext.commands import Bot
cogs = ["Modules.TGH.automod.automod", "Modules.TGH.automod.ouat",
"Modules.SSC.autoReply.Join", "Modules.SSC.autoReply.Leave"]
"Modules.SSC.autoReply.Join", "Modules.SSC.autoReply.Leave", "Modules.SSC.automod.Spam"]
prefix = 'o!'
@ -21,6 +21,7 @@ tokens = ''
client = Bot(command_prefix=prefix)
client.remove_command("help")
@client.event
async def on_ready():
print('Logged in as:')