IRCBot Plugin API
v5
|
#include <plugins.h>
Public Attributes | |
uint32(* | GetVersion )() |
Returns the bot version in the form 0x00AAIIFF where AA = Major Version, II = Minor Version, FF = Flags. More... | |
const char *(* | GetVersionString )() |
Returns the bot version as a string. More... | |
const char *(* | GetIP )() |
Returns the (hopefully) real IP of the bot's computer. It gets it via userhost on IRC just like most IRC clients. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long. More... | |
const char * | platform |
The platform the bot is running on. More... | |
void * | unused |
const char *(* | GetBasePath )() |
Returns the folder the bot is running from. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long. More... | |
char *(* | GetBindIP )(char *buf, size_t bufSize) |
Copies the global bind IP into buf (if set, will be empty string if not set). Return is buf if a bind IP is set or NULL otherwise. More... | |
int(* | get_argc )() |
Returns the number of arguments that were passed on the bot's command line. More... | |
const char *(* | get_argv )(int i) |
Returns argument i from the bot's command line. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long. More... | |
int64(* | get_cycles )() |
This is similar to GetTickCount(), it increases by one every millisecond (depending on system timer). It's starting value has no meaning unlike GetTickCount, so don't try to infer meaning into it. More... | |
void(* | ib_printf2 )(int pluginnum, const char *fmt,...) |
Prints to the bot console. All bot console output should be done through this function, not raw printfs or or other methods. More... | |
void(* | Rehash )(const char *fn) |
Reloads ircbot.text, optionally a different file. Use NULL to reload the last used ircbot.text. More... | |
int(* | NumPlugins )() |
Returns the number of loaded plugins. More... | |
PLUGIN_PUBLIC *(* | GetPlugin )(int32 plugnum) |
Returns plugin number plugnum. More... | |
bool(* | LoadPlugin )(const char *fn) |
This will attempt to load a plugin in the first empty plugin slot. More... | |
bool(* | LoadMessage )(const char *name, char *msgbuf, int32 bufSize) |
void(* | ProcText )(char *text, int32 bufSize) |
void(* | SetCustomVar )(const char *name, const char *val) |
void(* | DeleteCustomVar )(const char *name) |
void(* | BroadcastMsg )(USER_PRESENCE *ut, const char *buf) |
Broadcasts a message to all channels the bot is on (respecting the DoSpam flag). Some plugins also respond to this such as Twitter. More... | |
const char *(* | GetLangString )(const char *str) |
void(* | safe_sleep_seconds )(int32 sleepfor) |
Sleeps for the specified number of seconds. This is a thread-safe sleep that won't interfere with other running threads. More... | |
void(* | safe_sleep_milli )(int32 sleepfor) |
Sleeps for the specified number of milliseconds. This is a thread-safe sleep that won't interfere with other running threads. More... | |
uint32(* | genrand_int32 )() |
Generates a random number from the Mersenne Twister. More... | |
int(* | get_rand )(int min, int max) |
Generates a random number from min to max (inclusive), untested with negative numbers. More... | |
void(* | SendRemoteReply )(T_SOCKET *socket, REMOTE_HEADER *rHead, const char *data) |
Sends a reply/command to a remote connection. More... | |
int(* | SendMessage )(int toplug, uint32 MsgID, char *data, int32 datalen) |
Sends a message to a plugin or all plugins. More... | |
API_irc * | irc |
API_ial * | ial |
API_textfunc * | textfunc |
API_commands * | commands |
API_user * | user |
API_config * | config |
API_db * | db |
API_curl * | curl |
API_memory * | mem |
API_yp * | yp |
API_ss * | ss |
uint32(* BOTAPI::GetVersion)() |
Returns the bot version in the form 0x00AAIIFF where AA = Major Version, II = Minor Version, FF = Flags.
const char*(* BOTAPI::GetVersionString)() |
Returns the bot version as a string.
const char*(* BOTAPI::GetIP)() |
Returns the (hopefully) real IP of the bot's computer. It gets it via userhost on IRC just like most IRC clients. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long.
const char* BOTAPI::platform |
The platform the bot is running on.
void* BOTAPI::unused |
const char*(* BOTAPI::GetBasePath)() |
Returns the folder the bot is running from. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long.
char*(* BOTAPI::GetBindIP)(char *buf, size_t bufSize) |
Copies the global bind IP into buf (if set, will be empty string if not set). Return is buf if a bind IP is set or NULL otherwise.
int(* BOTAPI::get_argc)() |
Returns the number of arguments that were passed on the bot's command line.
const char*(* BOTAPI::get_argv)(int i) |
Returns argument i from the bot's command line. This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long.
int64(* BOTAPI::get_cycles)() |
This is similar to GetTickCount(), it increases by one every millisecond (depending on system timer). It's starting value has no meaning unlike GetTickCount, so don't try to infer meaning into it.
void(* BOTAPI::ib_printf2)(int pluginnum, const char *fmt,...) |
Prints to the bot console. All bot console output should be done through this function, not raw printfs or or other methods.
void(* BOTAPI::Rehash)(const char *fn) |
Reloads ircbot.text, optionally a different file. Use NULL to reload the last used ircbot.text.
int(* BOTAPI::NumPlugins)() |
Returns the number of loaded plugins.
PLUGIN_PUBLIC*(* BOTAPI::GetPlugin)(int32 plugnum) |
Returns plugin number plugnum.
bool(* BOTAPI::LoadPlugin)(const char *fn) |
This will attempt to load a plugin in the first empty plugin slot.
bool(* BOTAPI::LoadMessage)(const char *name, char *msgbuf, int32 bufSize) |
Loads a message defined in ircbot.text
name | The name of the message (ie. RadioOn, Song, etc.) |
msgbuf | The buffer to load it in to |
bufSize | The size of your buffer |
void(* BOTAPI::ProcText)(char *text, int32 bufSize) |
Does variable replacement in a string with IRCBot internal variables and those provided by plugins
If your plugin wants to provide variables you can handle IB_PROCTEXT in your message handler
text | The string to process |
bufSize | The size of your buffer that text is in |
void(* BOTAPI::SetCustomVar)(const char *name, const char *val) |
void(* BOTAPI::DeleteCustomVar)(const char *name) |
void(* BOTAPI::BroadcastMsg)(USER_PRESENCE *ut, const char *buf) |
Broadcasts a message to all channels the bot is on (respecting the DoSpam flag). Some plugins also respond to this such as Twitter.
const char*(* BOTAPI::GetLangString)(const char *str) |
This function is how translation to other languages is done in IRCBot
If you want a string to be able to be translated, you can use this function or the _() macro at the end of the file for more convenience
This is a return from a STL string's .c_str() so make sure you copy it because it may not be valid long
str | The string to translate |
void(* BOTAPI::safe_sleep_seconds)(int32 sleepfor) |
Sleeps for the specified number of seconds. This is a thread-safe sleep that won't interfere with other running threads.
void(* BOTAPI::safe_sleep_milli)(int32 sleepfor) |
Sleeps for the specified number of milliseconds. This is a thread-safe sleep that won't interfere with other running threads.
uint32(* BOTAPI::genrand_int32)() |
Generates a random number from the Mersenne Twister.
int(* BOTAPI::get_rand)(int min, int max) |
Generates a random number from min to max (inclusive), untested with negative numbers.
void(* BOTAPI::SendRemoteReply)(T_SOCKET *socket, REMOTE_HEADER *rHead, const char *data) |
Sends a reply/command to a remote connection.
Sends a message to a plugin or all plugins.
API_textfunc* BOTAPI::textfunc |
API_commands* BOTAPI::commands |
API_config* BOTAPI::config |
API_memory* BOTAPI::mem |
API_ss* BOTAPI::ss |