I know this question was asked before but I can't seem to find it anywhere so I'm just asking it. I have my discord bot send a message saying not to use a word unless in any channel but one (working); however, the bot also flags words that contain that word ex:
import discord
from discord.ext import commands
from discord.utils import get
bot = commands.Bot(command_prefix = '.')
@bot.event
async def on_message(message):
if message.author.id == bot.user.id:
return
words=['test']
if message.channel!='no-rules-lol':
for word in words:
if word in message.content.lower():
await message.channel.send('{0.author.mention} make sure that you do not use word unless you are in <#750445277130784788>'.format(message))
If a user says a word like 'testing' the bot flags it. I know there's a module or library or something that allows you to add word boundaries but I can't seem to find the post that talks about it.