Home > Blockchain >  Is there another URL link to react to discord messages?
Is there another URL link to react to discord messages?

Time:12-16

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}/@me",
              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}/@me",
              headers=headers)
print(r.status_code)

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

CodePudding user response:

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}/@me",

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/           
  • Related