Hey there! I was trying to send a message to a user using their ID but I am getting an error, I am using VS Code and Discord.js v14.7.0
Code:
client.users.fetch(reportObj.reporter).then(user => {user.send("Hey there! I am reaching out on behalf of the Armed Disease Control report team. Thank you for filing your report! One of our staff members has dismissed the report")})```
**reportObj.reporter** is a string containing an ID, for development it has been my ID.
Error:
DiscordAPIError[50035]: Invalid Form Body
user_id[NUMBER_TYPE_COERCE]: Value "null" is not snowflake.
at SequentialHandler.runRequest (C:\Users\24gav\Downloads\ADC\Bot1\node_modules@discordjs\rest\dist\index.js:667:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\24gav\Downloads\ADC\Bot1\node_modules@discordjs\rest\dist\index.js:464:14)
at async REST.request (C:\Users\24gav\Downloads\ADC\Bot1\node_modules@discordjs\rest\dist\index.js:910:22)
at async UserManager.fetch (C:\Users\24gav\Downloads\ADC\Bot1\node_modules\discord.js\src\managers\UserManager.js:91:18) {
requestBody: { files: undefined, json: undefined },
rawError: {
code: 50035,
errors: {
user_id: {
_errors: [
{
code: 'NUMBER_TYPE_COERCE',
message: 'Value "null" is not snowflake.'
}
]
}
},
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'GET',
url: 'https://discord.com/api/v10/users/null'
}
Node.js v17.4.0```