Skip to content
Valerie Pond edited this page May 24, 2021 · 4 revisions

Integration with Anope

Requirements:

If you don't have an SQL database setup, please check out the dependencies list for installing Valeyard

Setup:

Taking from earlier note our prefix, open up gateway.config.php using your favourite editor. I'll use nano here.

$ nano gateway.config.php

Now you'll want to add in a line for Valeyard to know your Anope table prefix from earlier, so it knows where to read information from. For example, if you went with anope_, your line here would be:

"anopetable" => "anope_",

Doesn't really matter where you add it, however if you do add it at the bottom, be careful to take note to add a comma at the end of the previous line so as not to mess up the array

???

Profit

(Re)start your bot!

Functions and identifiers

IsAnopeUser($nick)

This will check Anope's tables if the user is registered. This does NOT check if the user is online.

It will return true or false

IsOnline($nick)

This will check Anope's tables if the user is online.

It will return true or `false.

NsInfo($nick,$search)

This will let you search by column where $search = column for information related to a users current session.

Example:

echo NsInfo("Valware","ident");

The above would, at least on my network, return ~val

If none is found, false is returned.

Please see Anope's SQL tables for available columns.

IsAjoinEntry($nick,$chan)

This will return true or false depending on if the $chan is in $nick's NickServ AJOIN list.

AddAjoinEntry($nick,$chan)

This will return 1 if the operation completed successfully, or an error.

Example:

`if (($result = AddAjoinEntry($nick,$chan)) !== 1){ echo $error; }

DelAjoinEntry($nick,$chan)

This will return 1 if the operation completed successfully, or an error.

IsAnopeChan($chan)

This will return true or false depending on if the $chan is registered with ChanServ.

IsChan($chan)

This will return true or false depending on if the $chan exists.

Nick2ID($nick)

This will convert a users nick to their unique ID in the SQL table.

Else it will return false



ID2Nick($id)

This will convert a users unique ID in the SQL table to their nick.

Else it will return false



Chan2ID($chan)

This will convert a channel to it's unique ID in the SQL table.

Else it will return false



ID2Chan($id)

This will convert a channel's unique ID in the SQL table to its channel name.

Else it will return false

IsOn($nick,$chan)

Returns true if $nick is currently on $chan.

Else it will return false

hostname($nick)

Returns the hostname of $nick.

Else it will return false

ident($nick)

Returns the ident of $nick.

Else it will return false

gecos($nick)

Returns the GECOS/realname of a $nick.

Else it will return false

account($nick)

Returns the logged in account of a $nick.

Else it will return false

isaway($nick)

Returns true if $nick is marked as away.

Else it will return false

awaymsg($nick)

Returns $nick's AWAY message if $nick is set AWAY.

Else it will return false

userip($nick)

Returns a users IP address if they are online.

Else it will return false

usermode($nick)

Returns a users usermodes if they are online.

Else it will return false

UUID($nick)

Returns the UUID of $nick if they are online.

Else it will return false

ctcpversion($nick)

Returns the CTCP VERSION response asked for by StatServ if $nick is online.

Else it will return false

hostmask($nick)

Returns a userhost in nick!ident@hostname format if $nick is online.

Else it will return false

fullhost($nick)

Suggested by Koragg. Returns userhost in nick!ident@hostname#realname format if $nick is online.

Else it will return false