Roblox.lua in-game chat bot | Make chat commands

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” :woozy_face:

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 :pensive:
some menggokil

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 :flushed:

7 Likes

Could you release the source here and some documentation?

2 Likes

i edited it 3 days ago, maybe now it is correct?

1 Like

update: i added more variables and functions in the module

Looks really cool and reminds me of the “syntax” of discord.js a lot!

A few questions though

  1. Why would a person use this over checking the chat using plr.Chatted?
  2. Does this give us any extra functionality over using the above?
  3. Is there message styling? Like colors, markdown, or at the least bold, italic, etc
  1. i dont understand english too much well :pensive:
  2. maybe?
  3. i dont know if roblox chat have a text feature like that

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)

reason i made this

i was bored, and reminded about discord.js

why i made this garbage

i want to make chat commands easier in detecting player chats

ok, tbh, it seems more like a hassle but I gotta admit, pretty good work making it feel just like discord.js

1 Like

What is the use of tokens? Is it just to gain more similarities with discord.js or does it have impact on the functionality?

Anyway, fun contribution, really interesting haha

1 Like

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

just like discord developers and servers