I think that OOP is the right thing for what I want for this. The reason I put this on the Dev Forum is because it is to do with Roblox.
I am working on a promotion bot that people can buy. To make things a lot easier for me, in the long run, I wanted to set up a system where:
In studio, someone could write this line of code (Or something similar):
local bot = HttpService:PostAsync('MyVPSIp:Port/createBot', BotUser, BotPass, GroupId)
That would essentially create a “class” on the VPS, with that someone in studio could then do:
bot:Promote(UserId)
That would then use Roblox-Js to promote the user in the group that was specified when creating the bots class.
My issue is actually using OOP to do this. My script so far is only a prototype so it doesn’t need to look pretty.
This is the main bot.js
script:
const Express = require('express')
const rbx = require('./modules/RBXMain.js')
const app = Express()
app.get('/createBot', function(req, res) {
const bot = new rbx(req.query.BotUsername, req.query.BotPassword, req.query.GroupId)
})
app.listen(1786, function() {
console.log('Listening on port 1786')
})
My next script is the one called RBXMain.js
:
var method = rbx.prototype
function rbx(botUsername, botPassword, groupId) {
this.RobloxJS = require('roblox-js')
this.GroupId = groupId
this.RobloxJS.login(botUsername, botPassword).then(function() {
console.log('Logged In.')
}).catch(function(err) {
console.log(err.stack)
})
}
module.exports = rbx
All of this so far works perfectly. My issue is this: How could I then use another script called Promote.js
that promotes the specified user in the group that was specified before. How do I make RBXMain.js
and Promote.js
to interact with each other? Is oop even the best way to do this?