Reputation: 3
Apologies for the confusing title, I didn't know how to describe the problem in one sentence. Discord.py has been sending messages with punctuation or parenthesis that weren't there in the code, this is happening for several commands and I've tried rearranging variables to no success. Does anyone know how to fix this This is my code:
valid_level = random.randint(0,100)
valid_message = " you are ",valid_level,"% valid "
await client.send_message(message.channel,valid_message)
Instead of sending " you are (variable generated %) valid", the bot sends " (' you are ', 48, % valid ') " as the message.
Upvotes: 0
Views: 44
Reputation: 27495
This line
valid_message = " you are ",valid_level,"% valid "
creates a tuple: (' you are ', 48, % valid ')
You need to str.format
valid_message = " you are {}% valid ".format(valid_level)
#or
valid_message = f" you are {valid_level}% valid "
Upvotes: 2