Is there another URL link to react to discord messages?

Question:

I am trying to react discord server messages with emoji automatically. I am python code to do this:

import requests
import emoji
headers = {
    "authorization": token
}
em = emoji.emojize(':thumbs_up:')
r=requests.put(f"https://discord.com/api/v10/channels/{server_ID}/messages/{channel_ID}/reactions/{em}/%40me",
              headers=headers)
print(r.status_code)

The code is from here:
Token, channel id and server are correct.
Result is 404, which for me means the link is wrong, do I miss something ?

Checked id for channel and server twice, also token.
Tried to add urllib.parse module as you can see in following code:

import requests
import emoji
import urllib.parse
headers = {
    "authorization": token
}
em = emoji.emojize(':thumbs_up:')
em = urllib.parse.quote(em)
r=requests.put(f"https://discord.com/api/v10/channels/{server_ID}/messages/{channel_ID}/reactions/{em}/%40me",
              headers=headers)
print(r.status_code)

because found the emoji should mess the link, but nothing changed.

Asked By: mihai

||

Answers:

You will want to use this, with a / after messages.

r=requests.put(f"https://discord.com/api/v10/channels/{server_ID}/messages/{channel_ID}/reactions/{em}/%40me",

Also, use the following parameters. Note that this is only working for user accounts, not bot accounts.

import requests

url = f"https://discord.com/api/v10/channels/{channel_id}/messages/{message_id}/reactions/ /%40me"

payload={}
headers = {
  'Authorization': token
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
Answered By: Androz2091