Tcl Scripting

From ShoutIRC RadioBot Wiki
Revision as of 14:14, 25 October 2013 by Indy (talk | contribs) (Text replacement - "IRCBot" to "RadioBot")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Warning.gif This page is out of date and needs updating. You should not count on this information being 100% accurate.


  • Note TCL scripting was only in RadioBot v3, this page remains in case it ever makes a comeback.

An upcoming feature/plugin for RadioBot is the addition of Tcl Scripting. Those of you familiar with the Plugin API will notice the Tcl commands are a ported/simplified version of it.

However, there are of course some new commands specific to the Tcl scripts.

For example bind_event/unbind_event, see Tcl Events for more information on them.

unbind_all_events type
Removes all bound events of type - be careful though because Tcl has a global interpreter so it will remove the bound events from all scripts.
print string
You should use this instead of puts when possible because it will go through RadioBot's output buffering and logging.
SendPM netno nick/chan text
Sends a PM or channel text to IRC. You can also use the aliases msg or privmsg.
SendIRC netno text
Sends a raw IRC command to IRC.
GetBotNick netno
Get's the bot's nick on network netno. -1 is the bot's default nickname, 0+ is the bot's current nickname on that network.
GetBotVersion
The bot's version as a number.
GetBotVersionString
GetIP
Get the detected local IP.
GetPlatform
Get the current platform (Win32/Linux/etc.).
GetBasePath
Get the bot's working directory.
get_argc
Returns the argc value of the bot.
get_argv num
Returns item num from the argv[] array
LogToChan str
Send string to your LogChan (if defined).
Rehash fn
Rehash your ircbot.text (make fn "" to rehash the current ircbot.text, or specify a new filename to load a new one instead).
NumPlugins
Returns the number of loaded plugins
LoadPlugin fn
Load plugin with filename fn.
SendSock sock buf datalen
Send data to a socket
ClearSockEntries sock
Remove entries with socket sock from the SendQ.
IsValidUserName nick
Returns 1 if nick is a valid bot username, 0 otherwise.
GetUserNameFromHostmask hostmask
Returns the bot username associated with hostmask
GetUserLevel hostmask pass
Returns the user level associated with hostmask and pass (leave pass out or "" if you don't have the password)
GetUserPass nick
Returns the password associated with bot user nick
GetConfigSection parent name
Returns config sections, use NULL for parent for a root item

GetConfigSectionValue section name
Returns string config section value

GetConfigSectionLong section name
Returns integer config section value

IsConfigSectionValue section name
Returns 1 if value name is in section, 0 otherwise

Configuration Demo:
set sec [ GetConfigSection NULL "Base" ]
if { $sec != "NULL" } {
 set val [ IsConfigSectionValue $sec "Nick" ]
 print "RadioBot Nickname is set: $val\n"
 set val [ GetConfigSectionValue $sec "Nick" ]
 print "RadioBot Nickname: $val\n"
} else {
 print "Invalid section name!\n"
}
SendPluginMessage toplug MsgID data datalen
For MsgID see IPC Messages (all message ID's are set as constants in the Tcl interpreter).
NumNetworks
Returns the number of IRC networks that are set up.
IsNetworkReady netno
Returns 1 if IRC network netno is connected and logged in, 0 otherwise.
HasOwnerSupport netno
Returns 1 if IRC network netno supports owner/halfop/etc., 0 otherwise.
GetStreamInfo
How to use GetStreamInfo:

set info [ GetStreamInfo ];	
print "Current DJ: [ STATS_curdj_get $info ]\n";

See the STATS structure to see the available field names, you retrieve them the same way.


RadioBot vde

RadioBot main pages
Main PageInstallationChangelogCommandsPluginsFAQConfigurationCreditsRemote ClientBuilt-In VariablesMulti Sound Server ModeUsername Character Restrictions
Auto DJ Pages
Auto DJ Main PageWebRequest SystemSchedulerMP3 EncoderVoice SupportMySQL Plugin
RadioBot Programming vde

RadioBot Programming
Plugin APIRemote CommandsPlugin InitializationRadioBot DBChanging Command PermissionsShoutIRC Music Database
Lua Scripting
Lua PluginLua ScriptingLua Events