Bot reference

From Botdom Wiki

Jump to: navigation, search

It is suggested that this page should be moved to Botdom Documentation.

Please do not move the page by hand. It will be moved by an administrator with the full edit history. In the meantime, you may continue to edit the page as normal. You can discuss this decision on the talk page.

This is a technical reference on the most common methods in different bots.

PHP Bots

dAmnBot/NoodleBot xbot Futurism
dAmn functions
Join $channel dAmn_Join( $channel ); $sys_cl -> join( $channel ); $dAmn -> joinRoom( $channel );
Part $channel dAmn_Part( $channel ); $sys_cl -> part( $channel ); $dAmn -> partRoom( $channel );
Say $msg in $channel with $type (msg, npmsg or action) dAmn_msg( $msg, $channel, $type ); $sys_cl -> msg( $channel, $msg, $type ); $dAmn -> say( $msg, $channel );

$dAmn -> me( $msg, $channel );

$dAmn -> npmsg( $msg, $channel );

Kick $user from $channel for $reason dAmn_Kick( $user, $channel, $reason ); $sys_cl -> kick( $channel, $user, $reason ); $dAmn -> kick( $user, $channel, $reason );
Promote/demote $user to $privclass in $channel N/A

$sys_cl -> promote( $channel, $user, $privclass );
$sys_cl -> demote( $channel, $user, $privclass );

$dAmn -> promote( $username, $privclass, $channel );
$dAmn -> demote( $username, $privclass, $channel );

Ban/unban $user from $channel N/A

$sys_cl -> ban( $channel, $username );
$sys_cl -> unban( $channel, $username );

$dAmn -> ban( $username, $channel );
$dAmn -> unban( $username, $channel );

Set $channel's $property (topic or title) dAmn_Set( $channel, $property, $value ); $sys_cl -> set( $channel, $property, $value ); $dAmn -> set( $property, $value, $channel );
Admin function in $channel dAmn_Admin( $channel, $type, $typeval, $priv, $vals ); (NoodleBot only) $sys_cl -> admin( $channel, $type, $typeval, $priv, $vals ); $dAmn -> admin( $command, $channel );
Parses $priv (a channel privclass name or a channel privclass value) N/A

$sys_ch[$channel] -> parsePriv( $priv, $returnstring] )

  • $priv can be either a privclass name (string) or value (integer). The function returns the privclass value (integer) or name (string) depending on whether $returnstring is true or false/omitted.

.

Bot user functions
Get whois information for $user N/A
  • The function provided with dAmnBot/NoodleBot getinfo() is out-of-date for the current version of dAmn
$sys_cl -> whois( $user ) $dAmn -> getUserInfo( $user )
  • Information will be stored in the variable $latestwhois[ $user ].
See whether $user has $priv or more. user_has( $user, $priv ) hasMinPriv( $user, $priv )

$sys_users[$user] -> hasMinPriv()*

  • *provided $user has already been registered with the bot
$user -> has( $user, $priv )
See whether $user has $priv or less. N/A
  • This made it so that to test whether a user was banned (had priv 0), you had to use !user_has($user,$priv+1).
hasMaxPriv( $user, $priv )

$sys_users[$user] -> hasMaxPriv()*

  • *provided $user has already been registered with the bot
None yet.
Parses $priv (a bot privclass name or a bot privclass value) N/A

parsePriv( $priv, $returnstring )

  • $priv can be either a privclass name (string) or value (integer). The function returns the privclass value (integer) or name (string) depending on whether $returnstring is true or false/omitted.

$user -> getClassNameFromId( $id )

$user -> getClassIdFromName( $name )

System variables
Channel data
$properties = array (
 channel = array (
  "title", "topic" = array (
   p,
   by,
   ts,
   data
  ),
  "privclasses" = array (
   number => name,
   name => number,
  ),
  "members"/**/ = array (
   name => array (
    pc,
    usericon,
    symbol,
    realname,
    typename,
    gpc,
    count
   ),
  "privclassmembers"/***/ = array (
   privclassname => array (
    membername
   )
  )
 )
)
  • /**/ Members currently in the room
  • /***/ Only if obtained via /admin show users and /admin show privclass
$sys_ch = array(
 $channel => dAmnChan (
  name,
  title,topic = array (
   p,
   by,
   ts,
   data,
  ),
  members* = array (
   name => array (
    pc,
    count,
   )
  ),
  pcs = array (
   number => array (
    name,
    perms**,
    members** => array(),
   )
  )
 )
)
  • *Members currently in the room
  • **Only if obtained via /admin show users and /admin show privclass

Still unfinished.

$properties = array(
 "c" => array(
  $channel => array(
   "ti" => $title,
   "to" => $topic,
   "pc" => $privclasses,
   "u" => $users
  )
 ),
 "u" => array(
 ), // Unfinished, probably reorganizing
);
User data
$users = array (
 $name => priv,
)
$sys_users = array (
 $name => User (
  name,
  priv,
  info => array (
   usericon,
   symbol,
   realname,
   typename,
   gpc,
  )
  connections* => array (
   $index => array (
    online,
    onlinesince,
    idle,
    channels => array(),
   )
  )
 )
)
  • *Only if obtained via /whois [username]
$user->users = array (
 $privclassNumber = array (
  "__classname" => $privclassName,
  $username => $privclassNumber,
  // repeat
 )
 // repeat
)
Event data Assortment of variables. See process.php
$sys_trg* = array (
 type,
 mod,
 subj,
 obj,
 chan,
 cmd,
 args,
)
  • *Data within $sys_trg is re-set every time an event/command is triggered.
  • *Data within $sys_trg is also copied into multiple single-value variables for easy access. See xbot/Modules#Accessing event data for details.
Personal tools