Bot class

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.


This function registers the bot with the hub.
This function returns true on success and false on failure.

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.



This function unregisters the bot.
This function does not return a value.


This function returns the HeXHub ID of the bot.


This function returns the nickname of the bot.

Lua script sample

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
		-- The bot was not registered

	-- 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())

Generated on Thu Aug 21 11:24:07 2008 for HeXHub/HexScript by  doxygen 1.5.4
Site hosted by Logo