https://wiki.shoutirc.com/index.php?title=Tcl_Scripting&feed=atom&action=historyTcl Scripting - Revision history2024-03-28T14:12:35ZRevision history for this page on the wikiMediaWiki 1.37.1https://wiki.shoutirc.com/index.php?title=Tcl_Scripting&diff=4428&oldid=prevIndy: Text replacement - "IRCBot" to "RadioBot"2013-10-25T14:14:05Z<p>Text replacement - "IRCBot" to "RadioBot"</p>
<p><b>New page</b></p><div>{{needs-updating}}<br />
* Note TCL scripting was only in RadioBot v3, this page remains in case it ever makes a comeback.<br />
<br />
An upcoming feature/plugin for RadioBot is the addition of Tcl Scripting.<br />
Those of you familiar with the Plugin API will notice the Tcl commands are a ported/simplified version of it.<br />
<br />
However, there are of course some new commands specific to the Tcl scripts.<br />
<br />
For example bind_event/unbind_event, see [[Tcl Events]] for more information on them.<br />
<br />
unbind_all_events type<br />
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.<br />
<br />
print string<br />
You should use this instead of puts when possible because it will go through RadioBot's output buffering and logging.<br />
<br />
SendPM netno nick/chan text<br />
Sends a PM or channel text to IRC. You can also use the aliases msg or privmsg.<br />
<br />
SendIRC netno text<br />
Sends a raw IRC command to IRC.<br />
<br />
GetBotNick netno<br />
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.<br />
<br />
GetBotVersion<br />
The bot's version as a number.<br />
<br />
GetBotVersionString<br />
<br />
GetIP<br />
Get the detected local IP.<br />
<br />
GetPlatform<br />
Get the current platform (Win32/Linux/etc.).<br />
<br />
GetBasePath<br />
Get the bot's working directory.<br />
<br />
get_argc<br />
Returns the argc value of the bot.<br />
<br />
get_argv num<br />
Returns item num from the argv[] array<br />
<br />
LogToChan str<br />
Send string to your LogChan (if defined).<br />
<br />
Rehash fn<br />
Rehash your ircbot.text (make fn "" to rehash the current ircbot.text, or specify a new filename to load a new one instead).<br />
<br />
NumPlugins<br />
Returns the number of loaded plugins<br />
<br />
LoadPlugin fn<br />
Load plugin with filename fn.<br />
<br />
SendSock sock buf datalen<br />
Send data to a socket<br />
<br />
ClearSockEntries sock<br />
Remove entries with socket sock from the SendQ.<br />
<br />
IsValidUserName nick<br />
Returns 1 if nick is a valid bot username, 0 otherwise.<br />
<br />
GetUserNameFromHostmask hostmask<br />
Returns the bot username associated with hostmask<br />
<br />
GetUserLevel hostmask pass<br />
Returns the user level associated with hostmask and pass (leave pass out or "" if you don't have the password)<br />
<br />
GetUserPass nick<br />
Returns the password associated with bot user nick<br />
<br />
GetConfigSection parent name<br />
Returns config sections, use NULL for parent for a root item<br />
<br />
GetConfigSectionValue section name<br />
Returns string config section value<br />
<br />
GetConfigSectionLong section name<br />
Returns integer config section value<br />
<br />
IsConfigSectionValue section name<br />
Returns 1 if value name is in section, 0 otherwise<br />
<br />
Configuration Demo:<br />
set sec [ GetConfigSection NULL "Base" ]<br />
if { $sec != "NULL" } {<br />
set val [ IsConfigSectionValue $sec "Nick" ]<br />
print "RadioBot Nickname is set: $val\n"<br />
set val [ GetConfigSectionValue $sec "Nick" ]<br />
print "RadioBot Nickname: $val\n"<br />
} else {<br />
print "Invalid section name!\n"<br />
}<br />
<br />
SendPluginMessage toplug MsgID data datalen<br />
For MsgID see [[IPC Messages]] (all message ID's are set as constants in the Tcl interpreter).<br />
<br />
NumNetworks<br />
Returns the number of IRC networks that are set up.<br />
<br />
IsNetworkReady netno<br />
Returns 1 if IRC network netno is connected and logged in, 0 otherwise.<br />
<br />
HasOwnerSupport netno<br />
Returns 1 if IRC network netno supports owner/halfop/etc., 0 otherwise.<br />
<br />
GetStreamInfo<br />
How to use GetStreamInfo:<br />
<br />
set info [ GetStreamInfo ]; <br />
print "Current DJ: [ STATS_curdj_get $info ]\n";<br />
<br />
See the [[Struct:STATS|STATS]] structure to see the available field names, you retrieve them the same way.<br />
<br />
<br />
{{ircbot programming}}</div>Indy