diff --git a/Filter.py b/Filter.py new file mode 100644 index 0000000..678126f --- /dev/null +++ b/Filter.py @@ -0,0 +1,18 @@ +import discord +from discord.ext import commands + +class Filter: + def __init__(self, client): + self.client = client + + async def on_message(self,message): + filter_words= ["NIGGER", "NIGGA", "FAGGOT", "RETARDED","CUNT", "KYS","FUCK"] #Words to filter + MakeWordsUpper=message.content.upper() + for word in filter_words: + if word in MakeWordsUpper: #checks if the message sent contains any word from the filter_words + await self.client.delete_message(message) #Deletes the message + await self.client.send_message(message.channel, "You're not allowed to use that word here!") + + +def setup(client): + client.add_cog(Filter(client)) \ No newline at end of file diff --git a/discordBot.py b/discordBot.py index 2ccdbed..6c61968 100644 --- a/discordBot.py +++ b/discordBot.py @@ -16,7 +16,7 @@ BOT_PREFIX = ("?") TOKEN = "NTA1MTA1ODU0NjI2OTIyNTE2.DtAhPQ.r7Lhj6xGVkmTFHeIM0h5KNC3He0" client = commands.Bot(command_prefix=BOT_PREFIX) -extensions=["Fun","Music","Random","LocationWeather","User"] +extensions=["Fun","Music","Random","LocationWeather","User","Filter"] async def start(self):