Plugin:Lua
The Lua plugin lets you write custom scripts in the Lua scripting language.
Scripts go in the lua_scripts subfolder in your RadioBot folder.
Once your script is loaded, the bot will call the function 'init' in your script. It should return 1 if the script loaded successfully or 0 if there was an error.
It is OK to not include an 'init' function if you don't need it.
When the bot is shutting down it will call the 'quit' function (again, you can leave it out if you don't need it). The 'quit' function has no return value.
Built-in Functions and Events
Besides the built-in functionality of Lua, the bot adds many commands. You can find a list here.
By binding events you can have your script handle things like custom !triggers, channel joins/parts, etc. A list of the currently supported events is here.
Examples
Here is an example barebones file:
function init() ib_print("Script loaded.") return 1; end function quit() ib_print("Goodbye") end
Sample script implementing a custom PM trigger:
function pm_handler(hostmask, nick, uflags, netno, text) SendPM(netno, nick, "Thanks for the PM") return 0; end function init() bind_event("on_pm", "pm_handler", "!test") return 1; end
RadioBot v • d • e
|
---|
RadioBot main pages |
Main Page • Installation • Changelog • Commands • Plugins • FAQ • Configuration • Credits • Remote Client • Built-In Variables • Multi Sound Server Mode • Username Character Restrictions |
Auto DJ Pages |
Auto DJ Main Page • WebRequest System • Scheduler • MP3 Encoder • Voice Support • MySQL Plugin |
RadioBot Programming v • d • e
|
RadioBot Programming |
Plugin API • Remote Commands • Plugin Initialization • RadioBot DB • Changing Command Permissions • ShoutIRC Music Database |
Lua Scripting |
Lua Plugin • Lua Scripting • Lua Events |