In the Discord api I have the accent color which is the background color of the user. But this value returns null when color is default. How do I pull the default color?
12 Answers
This is an API limitation. This information is only available with bot.fetch_user as stated in The Documetation
Edit:
You were asking help with discord API, I realized that later. But that shouldn't cause an issue. It worked fine for me when I used requests module of python and sent a GET request to the /users/{userid} endpoint with Bot authorization token
Here is my code and output respectively:
import requests
import pprint
TOKEN = "My Bot Token"
headers = {"Authorization": f"Bot {TOKEN}"}
userid = 914596711010287698
req = requests.get(f"", headers=headers)
pprint.pprint(req.json()){'accent_color': 9279926, 'avatar': 'e9cefd0c155b6c84fe76ab6c9e7e4607', 'banner': None, 'banner_color': '#8d99b6', 'discriminator': '1328', 'id': '914596711010287698', 'public_flags': 128, 'username': 'Rose🌹'}just incase, pprint is an in-built module which is short for PrettyPrint, and it is used exactly for as the name suggests, printing json with readable indents and spacing.
let avatarUrl = user.displayAvatarURL()