Controling Discord Bot Through Roblox?

RIght now i want to create a discord bot that can create VC’s and Chats and can change their permissions. I have tried reading the discord api and http service but have not found how i can send a command to a discord bot. I would appreciate if you can link me any resources or wiki articles.

I don’t think you can, but you can try using this post. (to figure out if you can or not)

Is there any way i can send like a string and when its received it will do something?

I’m not sure if there is a direct way to do this, but you can get around it. You could create a private channel in your server where you can send a webhook from Roblox using HttpService. Your normal discord bot then could look for messages sent in that channel and run specific commands based on the message.

For example:

-- Roblox Server Sciprt
local HttpService = game:GetService("HttpService")
local url = "webhook-url"
local data = {
		["content"] = "CreateVC";
	}
local newdata = HttpService:JSONEncode(data)
HttpService:PostAsync(url, newdata)

This will send an embed using a webhook in the private channel.

// discord.js 

const Discord = require('discord.js')
const bot = new Discord.Client()

bot.on("ready",async ()=>{
  console.log(`${bot.user.username} is online`)
})

bot.on("message",async message=>{
 if(message.author.id === 'webhook-id' && message.channel.id === 'channel-id'){ // This makes sure that only the webhook can run the commands.
  if(message.content ==="CreateVC"){
   // Code to create vc
  }
 }
  
})
const token = 'bot-token'
bot.login(token);

Note: I haven’t tested this so there may be some errors but this is the general idea

1 Like