-2

I want to make a bot that detects the word "burp" in every sentence, after it sees one, it'll send a message with "weight kg"

weight=0
@client.event
async def on_message(ctx):
  if ctx.content == 'burp':
    weight+=1
    await client.send_message(f"{weight}kg")

This code has many flaws, and one of them is weight+=1 referenced before assignment and the second one is that this only detects the message "burp", but not in a sentence. How do I change this?

Sorry if I'm bothering with a simple question, I'm new to discord.py

vitaliis
  • 4,082
  • 5
  • 18
  • 40

1 Answers1

1
if "burp" in ctx.content:
   # do something
ObjectJosh
  • 601
  • 3
  • 14