Core Functions

From Bebot Wiki 2
Jump to navigationJump to search
Functions and Interfaces provided by default core modules.[edit]
Main Modules[edit]

Modules in the Main section are required for BeBot functionality. They are loaded before any other modules, and are loaded in a specific order.



security[edit]
    • File Path:** main/03_Security.php \\
    • Reference:** $this -> bot -> core("security")

check_access[edit]

Description[edit]

bool **check_access** ( __string__ $character, __string__ $access_level ) \\ Check to see if $character meets or exceeds $access_level.

Parameters[edit]

character[edit]

The name of the character an access check is being performed on.

access_level[edit]

The access level to check against. BANNED((Checking for banned users should be done with the is_banned() function.)), ANONYMOUS, GUEST, MAMEBER, LEADER, ADMIN, SUPERADMIN, OWNER.

Return Values[edit]

TRUE if the character meets or exceeds the give access level, otherwise false.

Examples[edit]

if ($this -> bot -> core("security") -> check_access("Glarawyn", "MEMBER")) {

   print_r("You access level is at least MEMBER!");

} else {

   print_r("Your access level is lower than MEMBER!");

}

See Also[edit]

 * is_banned()
 

is_banned[edit]

Description[edit]

bool **is_banned** ( __string__ $character ) \\ Check to see if $character is banned.

Parameters[edit]

character[edit]

The name of the character an access check is being performed on.

Return Values[edit]

TRUE if the character is banned, otherwise false.

Examples[edit]

if ($this -> bot -> core("security") -> is_banned("Glarawyn")) {

   print_r("You are banned!");

} else {

   print_r("You are not banned!");

}

See Also[edit]

 * check_access()

maintenance[edit]
    • File Path:** main/05_Maintenance.php


prefs[edit]
    • File Path:** main/06_Preferences.php

$this -> bot -> core("prefs")


create[edit]

Description[edit]

datatype **create** ( __string__ $module, __string__ $name, __string__ $description, __mixed__ $default, __mixed__ $possible_values) \\ Creates a new preference definition.

Parameters[edit]

module[edit]

Name of the module the preference is for.

name[edit]

Name of the preference.

description[edit]

Description of the preference.

default[edit]

Default value of the preference.

possible_values[edit]

List/Array/Something of possible values for the preference.

Return Values[edit]

This function does not return anything.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


get[edit]

Description[edit]

array **get** ( __mixed__ $name, __mixed__ $module=false, __mixed__ $setting=false ) \\ Retrieve preferences for a user. If only name is give, all preferences for the user will be returned. If name and module are given, all the user's preferences for that module will be returned. If name, module, and setting are given, only the specific preference will be returned.

Parameters[edit]

name[edit]

Character name or UID of the player we want to retrieve preferences for.

module[edit]

Name of the module to retrieve preferences for.

setting[edit]

Return Values[edit]

What does this function return.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


change[edit]

Description[edit]

string **change** ( __mixed__ $name, __string__ $module, __string__ $setting, __mixed__ $value ) \\ Changes a preference value.

Parameters[edit]

name[edit]

Character name or UID of the user to change a preference for.

module[edit]

Name of the module where the preference exists.

setting[edit]

Name of the preference to be changed.

value[edit]

New value for the preference.

Return Values[edit]

 * Preference for $name, {$module}->{$setting} was already set to '$value'. Nothing changed.
 * Preferences for $name, {$module}->{$setting} reset to default value '$value'
 * Preference was created for $name, {$module}->{$setting} = $value
 * Preferences for $name, {$module}->{$setting} changed to '$value'

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_change|other_change()]]


change_default[edit]

Description[edit]

datatype **change_default** ( __string__ $name, __string__ $module, __string__ $setting, __mixed__ $value ) \\ Changes the default value of a preference.

Parameters[edit]

name[edit]

Name of the person changing the default value.

module[edit]

Name of the module the preference exists under.

setting[edit]

Name of the preference.

value[edit]

New default value for the preference.

Return Values[edit]

 * The default value for {$module}->{$setting} has been set to '$value'.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_change_default|other_change_default()]]


exists[edit]

Description[edit]

datatype **exists** ( __string__ $module, __string__ $setting ) \\ Check to see if a preference exists.

Parameters[edit]

module[edit]

Name of the module.

variable2[edit]

Name of the preference.

Return Values[edit]

TRUE if the preference exists, otherwise false.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_exists|other_exists()]]




settings[edit]
    • File Path:** main/06_Settings.php

$this -> bot -> core("settings")


exists[edit]

Description[edit]

bool **function_name** ( __string__ $module, __string__ $setting ) \\ Checks if a setting exists.

Parameters[edit]

module[edit]

Name of the group/module.

setting[edit]

Name of the setting.

Return Values[edit]

True if the setting exists, otherwise false.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


get[edit]

Description[edit]

mixed **get** ( __string__ $module, __string__ $setting ) \\ Retrives a setting from the database.

Parameters[edit]

module[edit]

Name of the group/module.

setting[edit]

Name of the setting.

Return Values[edit]

Return Values[edit]

Returns the value of the specified setting.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


create[edit]

Description[edit]

datatype **create** ( __string__ $module, __string__ $setting, __mixed__ $value, __string__ $longdesc, __string__ $defaultoptions="", __bool__ $hidden=FALSE, __int__ $disporder=1 ) \\ Creates a new or Updates an existing setting in the database.

Parameters[edit]

module[edit]

Name of the settings group/module.

setting[edit]

Name of the setting.

value[edit]

Default value of the setting.

longdesc[edit]

Description of the setting.

defaultoptions[edit]

Semicolon (;) seperated list of options to display in the settings interface.

hidden[edit]

If set to true, the setting will be hidden from the settings interface.

disporder[edit]

Set the display order of the setting in the settings interface. By default settings are displayed alphabetically. This can override that.

Return Values[edit]

Returns an error array.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


del[edit]

Description[edit]

datatype **del** ( __string__ $module, __string__ $setting=NULL ) \\ Deletes a setting or group of settings from the database.

Parameters[edit]

module[edit]

Group/Module of the setting(s) to be deleted.

setting[edit]

Name of the setting to be deleted. If setting is omitted, all settings for the module will be deleted.

Return Values[edit]

Error status array.

Examples[edit]

// Delete the setting named example in the setting group named TestSettings $this -> bot -> core("settings") -> del("TestSettings", "Example"); // Delete all settings in the group named TestSettings $this -> bot -> core("settings") -> del("TestSettings");

See Also[edit]

* [[#other_function_name|other_function_name()]]


access_control[edit]
    • File Path:** main/09_AccessControl.php
roster_core[edit]
    • File Path:** main/10_Roster.php
flexible_security[edit]
    • File Path:** main/11_FlexibleSecurity.php
ini[edit]
    • File Path:** main/12_ConfigMagik.php


tools[edit]
    • File Path:** main/14_Tools.php

$this -> bot -> core("tools")


chatcmd[edit]

Description[edit]

datatype **chatcmd** ( __string__ $link, __string__ $title [, __mixed__ $origin ] ) \\ This function generates chat commands in front of a link, useful for inside of a text window.

Parameters[edit]

link[edit]

Usually the chat command without prefix.

title[edit]

Title of the link.

origin[edit]

Origin of the original chat command, or the desired channel for the generated chat command.

Return Values[edit]

 * <a href=\'chatcmd:///'.$chatcmd.$link . '\'>' . $title . '</a>

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


get_site[edit]

Description[edit]

string **get_site** ( __string__ $url [, __bool__ [, $strip_headers [, __int__ $server_timeout [, __int__ $read_timeout ]]]] ) \\ This function returns the content of the given URL as a string. If CURL is available it will be used, otherwise will use sockets.

Parameters[edit]

url[edit]

URL to retrive.

strip_headers[edit]

Optionally strip HTTP headers from the result. Default off.

server_timeout[edit]

Timeout for making a connection to the remote server. Only used for socket method. Default 25.

read_timeout[edit]

Timeout for reading data from the remote server. Only used for socket method. Default 30.

Return Values[edit]

Returns the content in a string.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_get_site|other_get_site()]]


xmlparse[edit]

Description[edit]

string **xmlparse** ( __string__ $xml, __string__ $tag ) \\ Parses XML elements.

Parameters[edit]

xml[edit]

XML to be parsed.

tag[edit]

XML tag to parse.

Return Values[edit]

Returns the content of the requested XML tag.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


make_blob[edit]

Description[edit]

string **make_blob** ( __string__ $title, __string__ $content ) \\ This function makes a text based click window.

Parameters[edit]

title[edit]

Title of the click window.

content[edit]

Content of the click window.

Return Values[edit]

Returns a text window string.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_make_blob|other_make_blob()]]


make_item[edit]

Description[edit]

string **make_item** ( __string__ $lowid, __string__ $highid, __string__ $ql, __string__ $name [, __bool__ $alternate ] ) \\ Creates a text blob.

Parameters[edit]

lowid[edit]

Low Quality Item ID for the item link.

highid[edit]

High Quality Item ID for the item link.

ql[edit]

Quality of the item link.

name[edit]

Name of the item.

alternate[edit]

Setting this to TRUE will return a link with single quotes instead of double quotes.

Return Values[edit]

Returns an item link.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


parse_item[edit]

Description[edit]

array **parse_item** ( __string__ $item ) \\ Takes an item string and returns an array with lowid, highid, ql and name.

Parameters[edit]

item[edit]

Description of variable1.

Return Values[edit]

Returns an array with lowid, highid, ql and name. If $item is unparsable it returns a BotError

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


is_item[edit]

Description[edit]

bool **is_item** ( __string__ $item ) \\ Returns true if $item is an itemref, false otherwise.

Parameters[edit]

item[edit]

An item link.

Return Values[edit]

Returns true if $item is an itemref, false otherwise.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_is_item|other_is_item()]]


int_to_string[edit]

Description[edit]

string **function_name** ( __int__ $int ) \\ Convert an overflowed (unsigned) integer to a string with the correct positive unsigned integer value.

Parameters[edit]

int[edit]

Overflowed integer.

Return Values[edit]

 * String with the correct positive unsigned integer value
 * If the passed integer is not negative, the integer is merely passed back as a string.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


string_to_int[edit]

Description[edit]

int **string_to_int** ( __string__ $string ) \\ Used to convert an unsigned interger in string form to an overflowed (negative) integer.

Parameters[edit]

string[edit]

String form of an integer.

Return Values[edit]

 * An overflowed (negative) integer.
 * If the passed string is not an integer large enough to overflow, the string is merely passed back as an integer.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


validate_player[edit]

Description[edit]

datatype **validate_player** ( __string__ $name [ , __bool__ $check_exists ] ) \\ Checks if a player name is valid and if the player exists.

Parameters[edit]

name[edit]

Name of the player we are validating.

check_exists[edit]

If set to true, the function will check to see if $name is a valid character in addition to checking if it is a valid player name.

Return Values[edit]

 * Returns BotError on failure
 * Returns ucfirst(strtolower($name)) if the player exists.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]



chat[edit]
    • File Path:** main/15_AOChatWrapper.php

$this -> bot -> core("chat")


get_uid[edit]

Description[edit]

string **get_uid** ( __string__ $user ) \\ Converts a name to user id.

Parameters[edit]

user[edit]

Name of the character to lookup.

Return Values[edit]

Returns the UID of the requested user.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


get_uname[edit]

Description[edit]

string **get_uname** ( __string__ $user ) \\ Gets the character name from a UID

Parameters[edit]

UID[edit]

UID to lookup.

Return Values[edit]

Returns a UID.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


buddy_add[edit]

Description[edit]

bool **buddy_add** ( __string__ $user [ , __bool__ $queue ] ) \\ Adds $user to the bot's buddy list.

Parameters[edit]

user[edit]

Name of the character to be added.

queue[edit]

Use the buddy queue (Default.) Set to FALSE if you want to bypass the queue.

Return Values[edit]

Returns TRUE on success, FALSE on failure.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


buddy_remove[edit]

Description[edit]

bool **buddy_remove** ( __string__ $user ) \\ Removes a user from the bot's buddy list.

Parameters[edit]

user[edit]

Username to remove.

Return Values[edit]

TRUE on success, FALSE on failure.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


buddy_exists[edit]

Description[edit]

bool **buddy_exists** ( __string__ $who ) \\ Check to see if a buddy exists on the bot's friends list.

Parameters[edit]

who[edit]

Name of player to check for.

Return Values[edit]

TRUE if the character is on the buddy list, otherwise FALSE.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


buddy_online[edit]

Description[edit]

bool **buddy_online** ( __string__ $who ) \\ Checks to see if $who is online.

Parameters[edit]

who[edit]

Name of the character to check online status for.

Return Values[edit]

TRUE if the character is online, otherwise false.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]


pgroup_invite[edit]

Description[edit]

datatype **pgroup_invite** ( __string__ $user ) \\ Invite user to private group.

Parameters[edit]

user[edit]

User to invite to bot's private group.


pgroup_kick[edit]

Description[edit]

datatype **pgroup_kick** ( __string__ $user ) \\ Kicks a user from the bot's private group.

Parameters[edit]

user[edit]

User who needs a #9 boot to the ass.


function pgroup_kick_all()

pgroup_kick_all[edit]

Description[edit]

datatype **pgroup_kick_all** ( ) \\ Kicks everyone from the bot's private group.


help[edit]
    • File Path:** main/15_BotHelp.php
chat_queue[edit]
    • File Path:** main/15_ChatQueue.php
colors[edit]
    • File Path:** main/15_Colors.php
command_alias[edit]
    • File Path:** main/15_CommandAlias.php
notify[edit]
    • File Path:** main/15_Notify.php
online[edit]
    • File Path:** main/15_OnlineDB.php
timer[edit]
    • File Path:** main/15_Timer_Core.php
Common Core Modules[edit]

Common Core Modules are shared by Anarchy Online and Age of Conan.

aliis[edit]
    • File Path:** core/Alias.php
alts[edit]
    • File Path:** core/Alts.php
bot_statistics[edit]
    • File Path:** core/BotStatistics.php
buddy_queue[edit]
    • File Path:** core/Buddy_Queue.php
funfilters[edit]
    • File Path:** core/FunFilters.php
irc[edit]
    • File Path:** modules/IRC.php
logon_notifies[edit]
    • File Path:** core/Logon_Notifies.php
module_core[edit]
    • File Path:** core/ModuleCatcher.php
player_notes[edit]
    • File Path:** core/PlayerNotes.php
points[edit]
    • File Path:** modules/Points.php
professions[edit]
    • File Path:** core/Professions.php
relay[edit]
    • File Path:** modules/Relay.php
shortcuts[edit]
    • File Path:** core/ShortCuts.php
statistics[edit]
    • File Path:** core/Statistics.php
stringfilter[edit]
    • File Path:** core/StringFilter.php
time[edit]
    • File Path:** core/Time.php
user[edit]
    • File Path:** core/User.php
Anarchy Online Specific Modules[edit]

These modules provide functionality unique to Anarchy Online.

whois[edit]
    • File Path:** core/ao/Whois.php
Age of Conan Specific Modules[edit]

These modules provide functionality unique to Age of Conan.

autouseradd[edit]
    • File Path:** modules/aoc/Autouseradd.php
items[edit]
    • File Path:** core/aoc/Items.php
whois[edit]
    • File Path:** core/aoc/Whois.php
Template for Module and Function Documentation[edit]
module name[edit]

function_name[edit]

Description[edit]

datatype **function_name** ( __datatype__ $variable1, __datatype__ $variable2 ) \\ What this function does.

Parameters[edit]

variable1[edit]

Description of variable1.

variable2[edit]

Description of variable2.

Return Values[edit]

What does this function return.

Examples[edit]

/*

  • Enter some Example Code
  • /

See Also[edit]

* [[#other_function_name|other_function_name()]]