All pastes #747800 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-24 11:09 UTC
rendered paste body
;
; pre script by infused
;

; fill this in first nub
; network can be $null
; password is optional
alias pre.setup {
  ; remote network name (type //echo $network on remote server to get )
  %pre.remotenetwork =
  ; local network
  %pre.localnetwork = $null
  ; pre bot name
  %pre.prebot = 
  ; remote channel you are taking the information from
  %pre.remoteprechannel = #prechan
  ; remote channel password, if it has one
  %pre.remoteprechannelpassword =
  ; local channel you are echoing the information to
  %pre.localprechannel = #pre
  ; local channel password, if it has one
  %pre.localprechannelpassword =
}

; sample config
; %pre.remotenetwork = rizon
; %pre.localnetwork = efnet
; %pre.prebot = SomeBot
; %pre.remoteprechannel = #pre4free
; %pre.remoteprechannelpassword =
; %pre.localprechannel = #pre
; %pre.localprechannelpassword =


; join pre chans
on 1:connect: {
  pre.setup
  if ($network == %pre.remotenetwork) {
    join %pre.remoteprechannel %pre.remoteprechannelpassword
  }
  elseif ($network == %pre.localnetwork) {
    join %pre.localprechannel %pre.localprechannelpassword
  }
}

; catch remote bot commands
on 1:text:*:%pre.remoteprechannel: {
  if (($nick == %pre.prebot)) {
    if ([pre] isin $1 || [nuke] isin $1) {
      ; change to local server
      scid 1
      if ($me ison %pre.localprechannel) { 
        msg %pre.localprechannel $1-
      }
    }
    if (%pre.search == $true) {
      if (no*results* isin $1) {
        ; no results found
        if (%pre.search == $true) {
          scid 1
          msg %pre.localprechannel $1-
        }
      }
      if ([pred] isin $1) {
        if (%pre.search == $true) {
          scid 1
          msg %pre.localprechannel $1-
        }
      }
      if (([group] isin $1) || ([oldest] isin $1) || ([latest] isin $1)) {
        scid 1
        msg %pre.localprechannel $1-
      }
    }
  }
}

on 1:text:*:?: {
  if ($nick == %pre.prebot) {
    scid 1
    ; inc the var and unset after 15 seconds
    ; to stop flooding max results is 8
    inc -u15 %pre.searchdupe 1
    if (%pre.searchdupe < 9) {
      msg %pre.localprechannel $1-
    }
  }
}

on 1:text:*:%pre.localprechannel: {
  ; set -u sets for a specific time to ensure the prechan
  ; is not flooded
  if (%pre.search != $true) {
    scid 2
    if ($me ison %pre.remoteprechannel) {
      scid 1
      if ($1 == !pre) {
        scid 2
        msg %pre.remoteprechannel $1-
        set -u7 %pre.search $true
      }
      if ($1 == !dupe) {
        scid 2
        msg %pre.remoteprechannel $1-
        set -u15 %pre.search $true
      }
      if ($1 == !group) {
        scid 2
        msg %pre.remoteprechannel $1-
        set -u10 %pre.search $true
      }
    }
  }
  else {
    msg $chan Sorry $nick, please wait will previous search expires
  }
}