Tutorial: How to make a bot in my chat service (Documentation)
You need something to trigger the bot to run, so the Register function with register a keyword. When anyone sends that keyword in the chat, the bot will do the corresponding function. Just have Register(Keyword to register as a string, Function name to do as a string). Do not declare your functions or variables names as Names, Keywords, Functions, Socket, NewMessages, Send, Register, Frame, TextBox, Button, ScrollButton, ReadButton, New or MessageReceive, as those variables and functions are needed for the web client to run correctly so don't overwrite them.
Of course, you need a way for your bot to interact with other people in the chat, so call Send(Message to send as a string) to send a message.
4. An Example
If you want to get super advanced, you might want to get the messages people send. Since the messages are in the iframe, this might be helpful.
If you want your own chat room, simply fork my repl. If you want to make it private, add a feature that prompts the user to enter the password and then make an XHR request to the server and if it matches the secret environment variable then allow the user into the room. You will have to figure out the specifics of that yourself (hey, replit is about coding, not being lazy).