Setting bot images on Discord webhooks possible?


#1
local payload = httpService:JSONEncode({
		content = chat:FilterStringForBroadcast(msg, player),
		username = player.Name .. ' - (#' .. player.UserId .. ')',
		image = game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
	})

httpService:PostAsync(webhook, payload)

This succesfully sends the message as well as changes the username of the bot to the players name and ID. I was hoping just adding in another line with image would work XD XD to set the image of the bot (webhook) to be an image of the player, but it didn’t unfortunately. Done some looking around and haven’t seen this answered anywhere, so just wondering if this is possible at all?

Figured since you can change the name of the bot for each sumbission that you’d be allowed to change the image as well.


#2

Nvm, found a page with all this information :smiley:

https://birdie0.github.io/discord-webhooks-guide/structure/avatar_url.html


#3

Mark your question as solved?


#4

Just a heads up, Discord does not currently allow for Webhooks to be sent from Roblox


#5

Have you attempted to use this to send the picture over?


#6

But it still works tho??


#7

Because you are using something like discord.osyr.is to get around this


#8

I’m not gonna post my entire link, but I’m pretty sure I’m not:

local webhook = 'https://discordapp.com/api/webhooks/


#9

Discord blocked Roblox from sending requests to their API server primarily because ratelimits and general rules around webhooks were not followed. A lot of tools to facilitate webhooks were not in accordance with their ToS and since it was widespread, they blocked Roblox altogether.

I believe Discord unblocked Roblox and allows such requests again, blacklisting certain programs that don’t respect ratelimits and furthermore their ToS. Don’t quote me on that.

Whether Discord has unblocked Roblox or not, I would encourage you to use a proxy server or something that respects ratelimits, such as Osyris’ Discord proxy. If you send requests to Discord raw, then be ready to face the consequences if you misuse webhooks.


Edit since this was marked as a solution.

You should be using an endpoint or Roblox method that returns a website content id to be used with the embed table, like what DataExhauster posted. Your goal is to have the image parameter use a PNG image.


#10

Good to know. And @NinjoOnline you can scratch what i said then lol


#11

I haven’t personally heard of discord unblocking roblox. One thing I noticed in the past is that in studio I could send requests directly to discord while in-game I couldn’t send the same requests without a proxy.

I assume this has to do with my local machine dealing with the HTTP requests instead of actual roblox servers. If I were you I would verify that you are capable of sending these requests in-game if you haven’t already.


#12

Because you’re in Studio.


#13

Works in online play, as well for multiple players


#14

If by this you mean changing the avatar image of the webhook to something from in-game you can pass the parameter “avatar_url” with the value as the image URL.

avatar_url = "IMAGE_URL_HERE";


#15

This is most likely the case. I don’t know of any public announcement regarding the unblocking of Roblox, but definitely a message for them being blocked.

Whether Discord has indeed unblocked Roblox or not, it is always recommended that you use a proxy server or something that is capable of respecting the Terms of Service for another platform’s API tools. One problem that many open source webhook tools had was that they were not respecting ratelimits (cough, Discord-based feedback systems, error logging, etc).


#16

Discord has not unblocked Roblox and if you were to manually switch your user agent to Roblox/WinInet in your browser and navigate to Discord it will show a blocked page.

As for anyone else wondering this is still the case. :slight_smile:


#17

I suspected so. Discord has no reason to unblock Roblox right now and this is a safer approach. I can say without a doubt that if request blocks were to be lifted, it would pose a problem for them again. Webhook tools on Roblox were not being properly operated and it was hard to do so when the open-source tools available were not appropriately watching what they were doing (not saying closed-source code didn’t have a hand in it either, but most likely less of one).


#18

You can use proxy and it’ll work just fine.
You can do the icon as well.

Pretty sure that Image Endpoints allow you to change the format to JSON, which would allow you to set the image URL. If not, this api should allow you to fetch them.