-3

So right now I have a bot that does the following code.

if '69' in message.content:
    await message.reply('nice. <:problem:819305690106822706>')

However, the bot replies if a ping/channel's id contains 69. This obviously wasn't supposed to happen. How do I stop it?

crw2
  • 101
  • 1
  • 5

1 Answers1

0

Ok I found a solution to the problem. Instead of using a simple in, I ended up running the code through some regex that cut out anything encased in these: <>. The regex I ended up using was

re.sub(r'\<[^>]*\>', '', message.content)

which is a slight variation of the answer from this question. Thus, the final code ended up being

if re.sub(r'\<[^>]*\>', '', message.content):
    await message.reply('nice. <:problem:819305690106822706>')
crw2
  • 101
  • 1
  • 5