On dns

From Scriptwiki
Jump to: navigation, search

The on DNS event triggers when a /dns query either succeeds or fails.

on <level>:DNS:<commands>

Note that this will also be triggered if you try to /dns a nickname, and the nickname is not on IRC.

$address in this context is the address or IP which was queried to be resolved.

Examples

On *:Dns: {
  echo -ag Found $dns(0) addresses for $address ( $+ $raddress $+ )!
  var %x = 1
  while ($dns(%x)) {
    echo -ag DNS Resolve %x Address = $dns(%x).addr ; IP = $dns(%x).ip
    inc %x
  }
}

This will echo all the resolved addresses.

See Also