Chatterbot - V3.0

Welcome to Chatterbot, the resource for your automated chat needs! Chatterbot is a small module where you can create a bot, customize it and allow it to send messages!

NOTE - This is my first time doing something like this, feedback is appreciated!

How To Use (New Version):
  1. Place the ModuleScript in ServerScriptService.
  2. Require it from the script you need.

Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
  1. Create a new bot with the bot.New() function. The chatbot’s name is a required parameter and must be provided for the bot to function properly.

Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot")

This will create a new bot named Bot.
However, your bot will not send messages until you call 2 main functions coming in step 4.

4a. Use newbot:JoinChannel() to allow the bot to send messages in provided channel. The channel is a required parameter and will error out if not provided.
Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot", "Developer", Color3.fromRGB(170, 0, 127), 12)
newbot:JoinChannel("All")

4b. Use newbot:SendMsg() to allow the bot to send messages in provided channel. The message is a required parameter and will error out if not provided.
Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot")
newbot:JoinChannel("All")
newbot:SendMsg("Howdy!")

That’s the basics! There are more things you can do to customize your bot though.

Example:

local bot = require(script.Parent.ChatterbotModule)
local newbot = bot.New("Bot")
newbot:JoinChannel("All")
newbot:AddTag("Developer", Color3.fromRGB(170, 0, 127))
newbot:Font(Enum.Font.FredokaOne)
newbot:ChatColor(Color3.fromRGB(255, 255, 255))
newbot:NameColor(Color3.fromRGB(85, 170, 127))
newbot:SendMsg("I'm a chat bot!")

FUNCTIONS:

:JoinChannel(string) - Allows the chatbot to join a chat channel and send messages. Channel param required.

:LeaveChannel(string) - Allows the chatbot to leave a chat channel. Channel param required.

:AddTag(string, Color3) - Adds a tag to the chatbot from the given data used when constructing a new chatterbot. Text to be displayed on tag and the color of the tag are required params.

:NameColor(Color3) - Changes the color of the given name. Color3 param required.

:ChatColor(Color3) - Changes the color of sent messages. Color3 param required.

:Font(Enum.Font.(Whichever font you chose)) - Changes the font of sent messages. Enum.Font param required.

:TextSize(number) - Changes the size of the text from sent messages. number param required.

:SendMsg(string) - Sends a message. Bot must be in appropriate channel or message sending will fail. Message param required.

:Nyani() - Sends a premade message. Bot must be in appropriate channel or message sending will fail. No param required.

:Destroy(string) - Destroys the chatterbot. The name of the chatbot is a required parameter (with appropriate casing).

How To Use (Legacy Version):
  1. Place the ModuleScript in ServerScriptService.
  2. Require it from the script you need.

Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
  1. Create a new bot with the bot.New() and newbot:Create() function. The chatbot’s name, tag data, and text size are required parameters and must be provided to function properly.

Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot", "Developer", Color3.fromRGB(170, 0, 127), 12)
newbot:Create()

This will create a new bot named Bot.
However, your bot will not send messages until you call 2 main functions coming in step 4.

4a. Use newbot:JoinChannel() to allow the bot to send messages in provided channel. The channel is a required parameter and will error out if not provided.
Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot", "Developer", Color3.fromRGB(170, 0, 127), 12)
newbot:Create()
newbot:JoinChannel("All")

4b. Use newbot:SendMsg() to allow the bot to send messages in provided channel. The channel and message are required parameters and will error out if not provided.
Example:

local bot = require(game.ServerScriptService.ChatterbotModule)
newbot = bot.New("Bot", "Developer", Color3.fromRGB(170, 0, 127), 12)
newbot:Create()
newbot:JoinChannel("All")
newbot:SendMsg("Howdy!", "All")

That’s the basics! There are more things you can do to customize your bot though.

Example:

local bot = require(script.Parent.ChatterbotModule)
local newbot = bot.New("Bot", "Developer", Color3.fromRGB(170, 0, 127), 12)
newbot:Create()
newbot:JoinChannel("All")
newbot:AddTag()
newbot:Font(Enum.Font.FredokaOne)
newbot:ChatColor(Color3.fromRGB(255, 255, 255))
newbot:NameColor(Color3.fromRGB(85, 170, 127))
newbot:SendMsg("I'm a chat bot!", "All")

FUNCTIONS:

:Create() - Initiates a new chatbot. No params required.

:JoinChannel() - Allows the chatbot to join a chat channel and send messages. Channel param required.

:LeaveChannel() - Allows the chatbot to leave a chat channel. Channel param required.

:AddTag() - Adds a tag to the chatbot from the given data used when constructing a new chatterbot. No params required.

:NameColor() - Changes the color of the given name. Color3 param required.

:ChatColor() - Changes the color of sent messages. Color3 param required.

:Font() - Changes the font of sent messages. Enum.Font param required.

:TextSize() - Changes the size of the text from sent messages. Provided when constructing a new chatterbot. No params required.

:SendMsg() - Sends a message. Bot must be in provided channel or message sending will fail. Message and channel params required.

:Nyani() - Sends a premade message. Bot must be in provided channel or message sending will fail. Channel param required.

:Destroy() - Destroys the chatterbot. No params required.

Getting the Module:

(V2.0) READ How To Use (New Version) for this version and more to function properly.
ChatV2.0.rbxl (38.8 KB)

(V3.0) READ How To Use (Legacy Version) for this version to function properly.
ChatV3.0.rbxl (47.2 KB)

NOTE: I won’t mind if you use it for your games and don’t credit me. However, if you get the code and edit it, you must credit me with a link.
If you want to help with this, reply down below.

New Version Video Demonstration:
robloxapp-20221127-2149479.wmv (419.5 KB)

25 Likes

Cool resource! I would recommend looking into OOP, similar to Instance.new. Then, using meta tables, the “object” will inherit certain functions.

Example:

local cb = require(chatterbot)

local bot = cb.new(“Bot”, Color3.new(1, 0, 0)) — first is bot name second is bot name color, which is default white or whatever

bot:SetNameColor(Color3.new(0, 0, 1))
bot:Send(“hello!”)

Also make sure to use PascalCase as it is the intended style for things like these.

Overall, nice job!

3 Likes

How would I be able to do these things? I’m not the best at scripting.

Small update - V1.1

Added bot.font(). This function allows you to change the font of the bot.
Example:

	local bot = require(script.Parent.BotManager)
    bot.new("Bot")
	bot.font(Enum.Font.FredokaOne)

Added bot.chatcolor(). This function allows you to change the color of the messages the bot sends.
Example:

    local bot = require(script.Parent.BotManager)
	bot.new("Bot")
	bot.chatcolor(Color3.fromRGB(16, 128, 128))

Renamed bot.color() to bot.namecolor() to avoid confusion.

Update - V1.2

Added bot.textsize(). This function allows you to change the size of the text the bot sends.
Example:

	local bot = require(script.Parent.BotManager)
    bot.new("Bot")
	bot.textsize(100)

Added bot.channel(). This function allows you to change the channel the bot sends messages in.
Example:

    local bot = require(script.Parent.BotManager)
	bot.new("Bot")
	bot.channel("Bot Channel")
Should I keep updating this? If so, what should I update? Reply down below!
  • Yes
  • No

0 voters

1 Like

Alright, it seems that the majority wants this updated. What would you like for me to update? Reply below!

1 Like

Can you include a video example of the chat bot working, nice job. :+1:

It’s a great module, I’ll definitely use it in my future projects and we’re my current ones.

2 Likes

Update V1.3 - Did this cause I’m bored,

bot.nyani() has been added. It makes your bot say nyani. Note - You cannot customize the message you send with this function.

Example:

local bot = require(game.ServerScriptService.BotManager)
bot.new("Bot")
bot.nyani("Bot")

Update - V1.4

Made some changes so bot doesn’t automatically join All channel.

NOTE - bot.channel() is now REQUIRED on V1.4 and higher for this API to successfully function. If you do not call this, the bot cannot send messages.

bot.leavechannel() has been added. This will make your bot leave the channel you provide. NOTE - If you misspell the channel name, it will prompt an error. Example:

local bot = require(game.ServerScriptService.BotManager)
bot.new("Bot")
bot.channel("All")
bot.leavechannel("All")
Should I release V1.0?
  • Yes
  • No

0 voters

NEW UPDATE (V1.0 After a Long Time…) -
5. Multi-bot support has been added! However, now you must specify the name of the bot you want to use in order to function properly. If not specified properly, errors will be thrown.

Example:

    local bot = require(game.ServerScriptService.BotManager)
    bot.new("Bot")
    bot.new{"NewBot")
	bot.namecolor(Color3.fromRGB(179, 179, 179), "Bot")
        bot.namecolor(Color3.fromRGB(170, 170, 170), "NewBot")
	bot.tag("Just A Bot", Color3.fromRGB(128, 0, 128), "Bot")
        bot.tag("Just A New Bot", Color3.fromRGB(0, 0, 128), "NewBot")

New warns when bot could malfunction!
Better stability and reliability!
Officially out of BETA phase!

1 Like

NEW UPDATE: V2.0
(Sorry for the delay!)

The Chatterbot Module has been completely reworked and is now easier to use.
Full guide on how to use this new version here!

MAIN CHANGES:
Multi-bot support has been removed from this new version!
Reworked functions and made it easier to manage a chatterbot!
Warnings will be displayed when a major event occurs. (ex. chatterbot joining a new channel).
A chatterbot must be constructed and created in order to use. (More details in the How to Use).

Small Changes:
Bug fixes
Switched functions to Camel Case
Renamed a couple of functions

Upcoming small change:
Adding a new premade message

NEW UPDATE: V3.0
(Sorry for the delay!)

The Chatterbot Module has been reworked and now supports multiple bots!
Full guide on how to use this new version here!

MAIN CHANGES:
Multi-bot support has been added for this new version!
Added error checking!

A chatterbot must be constructed and created in order to use. (More details in the How to Use - New Version).

Small Changes:
Bug fixes

Upcoming small change:
Adding a new premade message

1 Like