I am wanting to use the Roblox web API for a project of my discord bot, I wanted a kind of !groupinfo command to give the groups information.
I am using the api.roblox.com/groups/{groupid} api to attempt to get the group icon of any group with the supplied ID, the api does return a EmblemUrl but this is not an image file, its a roblox decal download without a file type.
Is there any other api/way to convert this decal into an image file? Any help is appreciated.
the link for the group sends a png, you can download that in your discord bot code and add .png onto it and host it somewhere so that its viewable.
If its only one group that you want this for, just right click the group image and click copy image link to copy the image url.
Unfortunately if this is the case, I believe your only option is to modify the extension, and re-upload it somewhere, as @Styre_x mentioned. I don’t know of any roblox endpoints that return a link to an image that is directly viewable.
You could try downloading the file to your bot’s directory, changing the extension, and uploading it to a site like Gyazo, though their developer API. You could then post the viewing link to display the image on discord though the bot, since discord visualizes Gyazo images and gifs automatically.
This would work but a very hacky inefficient process, but I have an idea, the URL given through emblemURL at the end has the decal number, and this number can be used for asset apis on roblox. So theoretically if theres an api for getting image files of a roblox image this could solve my problem.
From here you can pick the AssetId and Name fields to construct a link which previews the image itself, like you would see for any decal etc: The MurkClan - Roblox. Notice we have both the AssetId and the Name to construct this link for any given EmblemUrl.
Then with some webscraping, you can get the element that contains the image element, which lucky for us has the unique class thumbnail-span, the only element with this class has an image element, whose src property is a direct link to the image:
You can pick this link off and feed it directly into your bot’s message or embed, without any downloading or modification. You can see it working by replacing any image link through an Embed Visualizer: