Ask coding questions

← Back to all posts
help
CAUESPINDOLA (1)

if message.author.id != USER ID HERE:
msg = client.get_message(message, message.author)
await client.send_message(message.channel, message.content)

Does anyone know why it doesn't work? i'm making a bot for discord in python, i set up more n it works the purpose of the bot is to copy the user message

Answered by Coder100 (18893) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18893)

you must have taken this from like a tutorial, but you were supposed to replace USER ID HERE with your bot id. so:

if message.author.id != client.id
InvisibleOne (3208)

Is your ID in a string? It should be an integer (number)

InvisibleOne (3208)

your problem is that you are checking if it is equal to USER ID which has no value, and if is a variable you can't have a space between them.
It should be:

if message.author.id == 29349823498372984: # USER ID
  # do something
VulcanWM (2890)

What error does it show?

CAUESPINDOLA (1)

@VulcanWM File "main.py", line 69
if message.author.id != USER ID HERE:
^
SyntaxError: invalid syntax

and thank you, you're always here helping

VulcanWM (2890)

can i see the repl, it might be an indent issue @CAUESPINDOLA

CAUESPINDOLA (1)

@VulcanWM like I already identified my bot I put his id as a friend here I explain more agr of the error on the bottom line