Home > database >  how to add several words
how to add several words

Time:06-01

recently I got paid to make a discord bot so the 1st thing they wanted is no swearing so, I did it.it was working perfectly until Ithe circled part of pick I where I Need to add a lot of words added more than one banned words so how to add more than one word. If I add more than one word it is not working.

CodePudding user response:

Create a list of bad words, and check if the message content contains a bad word.

@client.event
async def on_message(message):
   bad_words = ['fuck', 'shit']
   for bad_word in bad_words:
      if bad_word in message.content:
         await message.channel.purge(limit=1)
         await message.author.send('Do not swear!')
         break

CodePudding user response:

Check out this thread: Discord.py swear word filter They're using a .txt which you can look up and use as a filter instead of having to type out every swear word you know.

  • Related