Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a discord bot profile the same as the user? / HTTPService

I will send the code here, but not the webhook link.

local url = "webhook link is here" 


local http = game:GetService("HttpService")

game.Players.PlayerAdded:Connect(function(plr)
local HookData = {
['username'] = plr.Name,

['content'] =  msg
}


HookData = http:JSONEncode(HookData)


http:GetAsync(url, HookData) 
end)

If the player chats, it logs it in my discord server with their name as the bot name, and the message as the bot message. How would I make the profile picture of the bot the same as the user, just like #site-chat in the discord of scripting helpers?

3 comments

0

this site is for roblox scripting, not discord

0

it is roblox scripting

0

It includes roblox scripting so HnN

1 answer

First off, insert the following code into the command bar

game:GetService("HttpService").HttpEnabled = true

Make a server script and insert the following code

local url = ""
local http = game:GetService("HttpService")

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
	
		local Data = {
		["avatar_url"] = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name,
		["username"] = player.Name,
		["content"] = msg
		}
 
		Data = http:JSONEncode(Data)
		http:PostAsync(url, Data)
 	end)
end)

Things to know

Remember to insert your discord webhook link into the quotation marks at the top.

If your game is popular, I don't recommend logging messages because you're logs will be constantly spammed with game chat.


Don't spoon feed!

This discussion is preserved as it was. New answers, comments, and votes are closed.