Core Functions

From Bebot Wiki 2
Revision as of 22:43, 16 September 2020 by B3b0tUzR (talk | contribs) (Created page with '====== Functions and Interfaces provided by default core modules. ====== ====== Main Modules ====== Modules in the Main section are required for BeBot functionality. They are lo…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Functions and Interfaces provided by default core modules.
Main Modules

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
    • File Path:** main/03_Security.php \\
    • Reference:** $this -> bot -> core("security")

check_access

Description

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

Parameters

character

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

access_level

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

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

Examples

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

 * is_banned()
 

is_banned

Description

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

Parameters

character

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

Return Values

TRUE if the character is banned, otherwise false.

Examples

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

   print_r("You are banned!");

} else {

   print_r("You are not banned!");

}

See Also

 * check_access()

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


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

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


create

Description

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

Parameters

module

Name of the module the preference is for.

name

Name of the preference.

description

Description of the preference.

default

Default value of the preference.

possible_values

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

Return Values

This function does not return anything.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


get

Description

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

name

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

module

Name of the module to retrieve preferences for.

setting

Return Values

What does this function return.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


change

Description

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

Parameters

name

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

module

Name of the module where the preference exists.

setting

Name of the preference to be changed.

value

New value for the preference.

Return Values

 * 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

/*

  • Enter some Example Code
  • /

See Also

* [[#other_change|other_change()]]


change_default

Description

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

Parameters

name

Name of the person changing the default value.

module

Name of the module the preference exists under.

setting

Name of the preference.

value

New default value for the preference.

Return Values

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_change_default|other_change_default()]]


exists

Description

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

Parameters

module

Name of the module.

variable2

Name of the preference.

Return Values

TRUE if the preference exists, otherwise false.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_exists|other_exists()]]




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

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


exists

Description

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

Parameters

module

Name of the group/module.

setting

Name of the setting.

Return Values

True if the setting exists, otherwise false.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


get

Description

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

Parameters

module

Name of the group/module.

setting

Name of the setting.

Return Values

Return Values

Returns the value of the specified setting.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


create

Description

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

module

Name of the settings group/module.

setting

Name of the setting.

value

Default value of the setting.

longdesc

Description of the setting.

defaultoptions

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

hidden

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

disporder

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

Return Values

Returns an error array.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


del

Description

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

Parameters

module

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

setting

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

Return Values

Error status array.

Examples

// 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

* [[#other_function_name|other_function_name()]]


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


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

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


chatcmd

Description

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

link

Usually the chat command without prefix.

title

Title of the link.

origin

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

Return Values

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


get_site

Description

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

url

URL to retrive.

strip_headers

Optionally strip HTTP headers from the result. Default off.

server_timeout

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

read_timeout

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

Return Values

Returns the content in a string.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_get_site|other_get_site()]]


xmlparse

Description

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

Parameters

xml

XML to be parsed.

tag

XML tag to parse.

Return Values

Returns the content of the requested XML tag.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


make_blob

Description

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

Parameters

title

Title of the click window.

content

Content of the click window.

Return Values

Returns a text window string.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_make_blob|other_make_blob()]]


make_item

Description

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

Parameters

lowid

Low Quality Item ID for the item link.

highid

High Quality Item ID for the item link.

ql

Quality of the item link.

name

Name of the item.

alternate

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

Return Values

Returns an item link.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


parse_item

Description

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

Parameters

item

Description of variable1.

Return Values

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


is_item

Description

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

Parameters

item

An item link.

Return Values

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_is_item|other_is_item()]]


int_to_string

Description

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

Parameters

int

Overflowed integer.

Return Values

 * 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

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


string_to_int

Description

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

Parameters

string

String form of an integer.

Return Values

 * 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

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


validate_player

Description

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

Parameters

name

Name of the player we are validating.

check_exists

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

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]



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

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


get_uid

Description

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

Parameters

user

Name of the character to lookup.

Return Values

Returns the UID of the requested user.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


get_uname

Description

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

Parameters

UID

UID to lookup.

Return Values

Returns a UID.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


buddy_add

Description

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

Parameters

user

Name of the character to be added.

queue

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

Return Values

Returns TRUE on success, FALSE on failure.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


buddy_remove

Description

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

Parameters

user

Username to remove.

Return Values

TRUE on success, FALSE on failure.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


buddy_exists

Description

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

Parameters

who

Name of player to check for.

Return Values

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

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


buddy_online

Description

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

Parameters

who

Name of the character to check online status for.

Return Values

TRUE if the character is online, otherwise false.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]


pgroup_invite

Description

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

Parameters

user

User to invite to bot's private group.


pgroup_kick

Description

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

Parameters

user

User who needs a #9 boot to the ass.


function pgroup_kick_all()

pgroup_kick_all

Description

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


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

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

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

These modules provide functionality unique to Anarchy Online.

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

These modules provide functionality unique to Age of Conan.

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

function_name

Description

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

Parameters

variable1

Description of variable1.

variable2

Description of variable2.

Return Values

What does this function return.

Examples

/*

  • Enter some Example Code
  • /

See Also

* [[#other_function_name|other_function_name()]]