hi, today i made a module that lets you make chat commands from [fake] clients, this module is inspired by this post, discord.js and discordia. click here to get the module theres a list of functions and an example, my module deny request to make a token / client if it is from a client [hackers main].
i dont know what to do with @R0bl0x10501050 's reply, so heres it @Loominatrx said me to edit this post to be more “profesional”
example
local Roblox_lua = require(6600065067) -- module
local Client = Roblox_lua:Client() -- new client
local Token = Roblox_lua:RegisterToken('MyToken') -- make a new token
local Prefix = '/'
Client:Login(Token) -- login
Client.user:SetUsername('My Bot') -- change name
Client:On('Message', function(message) -- { content = string, author = player }
message:ToLowerCase() -- make the message content lower case
if not message:StartsWith(Prefix) then return end -- not running a command
if message.content == Prefix .. 'bean' then
Client:Reply('Apple') -- send public message
end
end)
result
this image shows the bot responding first
more client stuff will be added same as discord.js client stuff
updates i made
v1: module published
v2: added variables, functions
v3: added more variables, functions, token data
v4: errors fixed
sorry if it is messy or short code because im not pro enough and im bad at english
Well, there is already really great chat modules out there that excel at this.
For the first one, this is what I am talking about
local Players = game:GetService("Players")
local prefix = "/"
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local cmd = message:split(" ")
if cmd[1] == prefix.."bean" then
-- Do code OR, write a command handler using module scripts
end
end)
end)
if you have 2 scripts,
script 1 is changing the bot’s name
script 2 is just showing the bot’s name that being changed from script 1
it is the use of the tokens