Discord BOT online/offline

Hello,

How do I make the bot online? And I would like it to post in server when an player buys an gear, I have my BOT in server, may you just explain it here? I seen some tutorials but not explaining properly.

I need help by steps a steps to make me understanding better.

1 Like

Honestly I have no clue what you want, could a explain it a little bit better?

An BOT to be online and making bot to pop up once a player has bought an gear. Like this “(Player) has bought a gear!”

Couldn’t you instead use a webhook (much more easier) and make a POST request to that webhook when someone buys a gear?

3 Likes

Discord bots cannot be created through ROBLOX or HttpService. Discord bots are hosted through an online server or API and cannot be created nor used on ROBLOX.

ROBLOX can only communicate through webhooks. Webhooks are neither online or offline as they are not accounts, and instead pieces of code.

Also, the developers on the forum will not write you a script. The best way to learn is to figure it out yourself.

1 Like

Yea, you should use a webhook instead. They’re much easier to set up and use. Then, you can simply use HttpService and send post requests.

HOWEVER you need to make sure that you don’t hit the rate limits. This can lead to your discord server and your discord account being terminated. There are a few things you have to do to prevent this:

  1. Use MessagingService to communicate across servers. This is especially important because you want to make sure that the webhook limits aren’t reached from ALL of the servers combined, not just 1 server.
  2. Send the messages in 1 post request, every 2 minutes or something like that. Don’t make a new post request for each individual purchase.
  3. Have measures in place to prevent players from spam purchasing items. If they do purchase things without a gap in between, wait to send the post request (don’t send it immediately.)

If you end up using Discord webhooks the following code will let you do it. I made it all packed into a simple function that just requires the Player and Product information.

local HttpService = game:GetService("HttpService")

local discordWebhookLink = "LINK HERE"

local function sendPurchuseInfoToDiscord(player,product)
	local JSONData = HttpService:JSONEncode({["content"] = player.." just bought "..product.." from the shop!"})
	HttpService:PostAsync(discordWebhookLink,JSONData)
end
1 Like

What type of script and where do I put? Workspace?

Server script inside of ServerScriptService. You don’t want the client to have access to this script since it contains a link to your webhook.

Okay done, how do I make Webhook to appear in server?

Use this since it has images and the whole thing explained out.

You can create a webhook in the channel settings menu (webhooks are tied to channels and post in that channel automatically). You can also set their name and profile picture. Refer to my post above to see how to use it.

Discord banned the Roblox User-Agent so that won’t work. U can use a Proxy tho. Or have a bot hosted on ur own Server and have it listen on certain endpoints.

Bots purely on ROBLOX won’t work since they require a Websocket connection