IRCBot Plugin API  v5
Public Attributes | List of all members
BOTAPI Struct Reference

#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_ircirc
 
API_ialial
 
API_textfunctextfunc
 
API_commandscommands
 
API_useruser
 
API_configconfig
 
API_dbdb
 
API_curlcurl
 
API_memorymem
 
API_ypyp
 
API_ssss
 

Member Data Documentation

uint32(* BOTAPI::GetVersion)()

Returns the bot version in the form 0x00AAIIFF where AA = Major Version, II = Minor Version, FF = Flags.

See also
IRCBOT_VERSION_FLAG_BASIC
IRCBOT_VERSION_FLAG_FULL
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

Parameters
nameThe name of the message (ie. RadioOn, Song, etc.)
msgbufThe buffer to load it in to
bufSizeThe size of your buffer
Returns
true if the message was loaded successfully, false otherwise
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

Parameters
textThe string to process
bufSizeThe size of your buffer that text is in
See also
IBM_PROCTEXT
IB_PROCTEXT
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

Parameters
strThe 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.

int(* BOTAPI::SendMessage)(int toplug, uint32 MsgID, char *data, int32 datalen)

Sends a message to a plugin or all plugins.

API_irc* BOTAPI::irc
See also
API_irc
API_ial* BOTAPI::ial
See also
API_ial
API_textfunc* BOTAPI::textfunc
See also
API_textfunc
API_commands* BOTAPI::commands
See also
API_commands
API_user* BOTAPI::user
See also
API_user
API_config* BOTAPI::config
See also
API_config
API_db* BOTAPI::db
See also
API_db
API_curl* BOTAPI::curl
See also
API_curl
API_memory* BOTAPI::mem
See also
API_memory
API_yp* BOTAPI::yp
See also
API_yp
API_ss* BOTAPI::ss

The documentation for this struct was generated from the following file: