The Bot class represents a 'bot' (a bot will apear as an operator in the nicklist of the hub).
Hex.Bot() returns a new object of type Bot.
A bot will only remain registered with the hub (visible to users), as long as the Bot object you created is valid.
Once the object gets collected by the lua garbage collector then the bot will automatically be unregistered.
If a user sends a PM (private message) to the bot The OnPmToBot(iBotId, iUserId, sData) callback will be called in your script.
A script is not required to process messages sent in PM to a bot.
A registered bot may or may not be renamed upon registration with hexhub, for example if the nickname is already taken. An operator of the hub may use the !rename trigger to rename the bot, and therefore you should always use the bot:GetNick() function to determine the nickname of your bot if your script depends on the nickname used to register the bot.
mybot = nil function OnLoad() -- Create a new bot object mybot = Hex.Bot() -- Register the bot with the hub if mybot:Register("FuckingBot") == true then -- The bot was succesfully registered else -- The bot was not registered end -- Check the nickname of the bot just in case it was renamed if mybot:GetNick() ~= "FuckingBot" then print("Bot registered, but renamed to: "..mybot:GetNick()) end end