Error While Making Discord Bot

Question:
It says something about STR in it, but I have no idea what is wrong.

Error Photo:
image

Code Snipit:

async def on_ready():
  print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(msg):
  if msg.author == client.user:
    return
  if msg.content('/people'):
    await msg.channel.send('XYZ')
  elif msg.content('/teamcomp'):
    await msg.channel.send('XYZ')
my_secret = os.environ['token']
client.run(my_secret)

Try msg.content == "/people"? It almost seems like “msg” or “content” might be a string (referred to as str), but try this first.

2 Likes

What @Firepup650 said was right, msg.content is not a function, it is a str. Other than that, here is a tip: use ext.commands off the bat, it is easier to use, and if you do not use it (I made this mistake) you will make something quite painful in the end. (Mine had main, main1, main2, and the code was super messy)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.