Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatBotProject/Filter.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18 lines (14 sloc)
726 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |