simple !request

By Chaz on May 10, 2005

on request whois's nick to see if hes op on that chan..
Disallows , in the channel request, usually !request #chan,0 makes it part all chans.
can disallowed chans etc, if the request chan has less then 20 users it fails.
it fails if the chan has no Q or L (can be removed), fails if the chan has key/secret/banned bot/invite only/limit

on @*:TEXT:!request *:%r.chan: {
;if a channel is requested
  if ($2) {
;check for current request
    if (!%request) {
;if the user requested a chan with a #
      if ($wildtok($2,#*,0,32)) {
;if , isn't in $2, so the user cant request mutliple channels.
;you can use $gettok instead
        if ($chr(44) !isin $2) {
;check for channel isnt in the disallowed list
          if (!$istok(%disallowed,$2,32)) {
;set a request
            set -u60 %request 1
            mode $chan +m
            set %req.chan $2
            set %req.nick $nick
            msg $chan Checking request for $2
            ;whois the nick
            whois $nick
          } 
          else {
            notice $nick That channel is disallowed.
          }
        } 
        else {
          notice $nick That channel contained a , this is an illegal character.
        }
      } 
      else {
        notice $nick Please enter a channel with a $chr(35)
      }
    } 
    else {
      notice $nick There is a request current.
    }
  }
  else {
    notice $nick Please add a channel.
  }
}

;whois the nick, check if he is @#requestchan
raw 319:*: {
  if (@ $+ %req.chan isin $3-) {
    join %req.chan
    msg %r.chan User is opped in %req.chan $+ , checking request.
  }
  else {
    msg %r.chan Request failed for %req.chan $+ . Reason: You either aren't opped on %req.chan $+ , or mode +s is set. 
    unset %req*
    mode %r.chan -m
  }
}

;end of /names list raw
raw 366:*: {
  if (%request) {
    if ((L ison %req.chan) || (Q ison %req.chan)) {
      if (S !ison %req.chan) {
        if ($nick($chan,0) >= 20) {
          msg %r.chan Request successful.
;relay to your bot name here, with its commands
          msg botnicknamehere join %req.chan
          part %req.chan
          unset %req*
          mode %r.chan -m
        }
        else {
          msg %r.chan Request failed for %req.chan $+ . Reason: Less then 20 users. Users: $nick(%req.chan,0)
          part %req.chan
          unset %req*
          mode %r.chan -m
        }
      }
      else {
        msg %r.chan Request failed for %req.chan $+ . Reason: S ison %req.chan $+ .
        part %req.chan
        unset %req*
        mode %r.chan -m
      }
    }
    else {
      msg %r.chan Request failed for %req.chan $+ . Reason: You need to have L or Q on your channel.
      part %req.chan
      unset %req*
      mode %r.chan -m
    }
  }
}

;/whois, the requester if nick doesnt exist
raw 401:*: { 
  if (%request) {
    msg %r.chan Request failed for %req.chan $+ . Reason: nickname doesn't exist.
    unset %req*
    mode %r.chan -m
  }
}

;raw for full channel
raw 471:*: {
  if (%request) {
    msg %r.chan Request failed for %req.chan $+ . Reason: channel is full.
    unset %req*
    mode %r.chan -m
  }
}

;raw for invite only
raw 473:*: {
  if (%request) {
    msg %r.chan Request failed for %req.chan $+ . Reason: invite only is on the channel.
    unset %req*
    mode %r.chan -m
  }
}

;raw for banned
raw 474:*: {
  if (%request) {
    msg %r.chan Request failed for %req.chan $+ . Reason: I am banned from that channel.
    unset %req*
    mode %r.chan -m
  }
}

;raw for key
raw 475:*: {
  if (%request) {
    msg %r.chan Request failed for %req.chan $+ . Reason: channel has a key.
    unset %req*
    mode %r.chan -m
  }
}

on *:NICK: { 
  if ($nick == %req.nick) {
    set %req.nick $newnick 
  }
}

on 100:TEXT:!disallowed:*: {
  notice $nick Disallowed channels are:
  notice $nick %disallowed
}

on 100:TEXT:!allow *:*: {
  if ($istok(%disallowed,$2,32)) {
    set %disallowed $remtok(%disallowed,$2,32)
  }
  else {
    notice $nick That channel isn't in my list.
  }
}

on 100:TEXT:!disallow *:*: {
  if (!$istok(%disallowed,$2,32)) {
    set %disallowed $addtok(%disallowed,$2,32)
    else {
      notice $nick That channel is already in my list.
    }
  }
}

Comments

Sign in to comment.
xelent   -  Nov 27, 2008

[00:55:05] kungen sets mode: +m
[00:55:05] <@kungen> User is opped in #xelent, checking request.
[00:55:06] <@kungen> Request failed for #xelent. Reason: Less then 20 users. Users: 30
[00:55:11]
kungen sets mode: -m

 Respond  
supergeo   -  May 11, 2005

Nice documentation throughout.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.