Channel Services / mode with simple command

By ToySoldier on Jul 24, 2007

BIG EDIT:

Script totaly re-scripted.

Now gives owner sop aop hop vop
+ao +o +h +v
You can ban / kickban / kick
You can set modes with /chanmode +m (Example)
You can quick-set modus:
Moderated: /Spam
No Nickchanged: /nickspam
No kicks except bot: /kickspam

Comments please.

E1: Scakk, thanks for the better version :)

/usermode {
  if ( $1 = add ) {
    if ( $2 = owner ) { mode # +q $3 }
    if ( $2 = sop ) { chanserv sop # add $3 | mode # +a $3 | mode # +o $3 }
    if ( $2 = aop ) { chanserv aop # add $3 | mode # +o $3 }
    if ( $2 = hop ) { chanserv hop # add $3 | mode # +h $3 }
    if ( $2 = vop ) { chanserv vop # add $3 | mode # +v $3 }
  }
  if ( $1 = del ) {
    if ( $2 = owner ) { mode # -q $3 }
    if ( $2 = sop ) { chanserv sop # del $3 | mode # -a $3 | mode # -o $3 }
    if ( $2 = aop ) { chanserv aop # del $3 | mode # -o $3 }
    if ( $2 = hop ) { chanserv hop # del $3 | mode # -h $3 }
    if ( $2 = vop ) { chanserv vop # del $3 | mode # -v $2 }
  }
  if ( $1 = op ) { mode # +o $2 }
  if ( $1 = deop ) { mode # -o $2 }
  if ( $1 = halfop ) { mode # +h $2 }
  if ( $1 = dehalfop ) { mode # -h $2 }
  if ( $1 = voice ) { mode # +v $2 }
  if ( $1 = devoice ) { mode # -v $2 }
}
alias umode {
  if ($1 == ban) && ($2) {
    if ($address($2,2)) { mode # +b $address($2,2) }
    else { mode # +b $2 }
  }
  if ($1 == unban) && ($2) {
    if ($address($2,2)) { mode # -b $address($2,2) }
    else { mode # -b $2 }
  }
  if ($1 == kick) && ($2) {
    if ($address($2,2)) { kick # $2 $3 }
  }
  if ($1 == kickban) && ($2) {
    if ($address($2,2)) {
      mode # +b $address($2,2)
      kick # $2 $3
    }
  }
}

/cmode /mode # $1
/spam /mode # +m
/nspam /mode # +N
/kspam /mode # +Q
/dcmode /mode # - $+ $1
/dspam /mode # -m
/dnspam /mode # -N
/dkspam /mode # -Q

Comments

Sign in to comment.
Jethro   -  Dec 02, 2009

Your umode alias can be written a bit with regex:

alias umode {
  if ($regex($1-,/((un|kick)?ban|kick)\s((?:\S+))/iS)) {
    if ($regml(1) == kick) { $iif($2,kick # $v1 $2-) }
    if ($regml(1) == kickban) { $iif($2,ban -k # $v1 2) } 
    if ($regml(1) == ban) { $iif($2,mode # +b $address($v1,2) }
    if ($regml(1) == unban) { $iif($2,mode # -b $address($v1,2) }
  }
}

One thing I don't get is, why are you banning a user's nick and host one or the other? You can just ban the host solely, and for 'kickban,' you can utilize the use of /ban with the -k switch and its address type.

 Respond  
PS2Torrents   -  Dec 02, 2009

where does this go?

 Respond  
Scakk   -  Jul 26, 2007

There seemed to be to many seperate lines when it could be shorter using \" | \". I also changed the aliases at the bottom and added a few if that it is ok.

/usermode {
  if ( $1 = add ) {
    if ( $2 = owner ) { mode # +q $3 }
    if ( $2 = sop ) { chanserv sop # add $3 | mode # +a $3 | mode # +o $3 }
    if ( $2 = aop ) { chanserv aop # add $3 | mode # +o $3 }
    if ( $2 = hop ) { chanserv hop # add $3 | mode # +h $3 }
    if ( $2 = vop ) { chanserv vop # add $3 | mode # +v $3 } 
  }
  if ( $1 = del ) {
    if ( $2 = owner ) { mode # -q $3 }
    if ( $2 = sop ) { chanserv sop # del $3 | mode # -a $3 | mode # -o $3 } 
    if ( $2 = aop ) { chanserv aop # del $3 | mode # -o $3 }
    if ( $2 = hop ) { chanserv hop # del $3 | mode # -h $3 }
    if ( $2 = vop ) { chanserv vop # del $3 | mode # -v $2 } 
  }
  if ( $1 = op ) { mode # +o $2 }
  if ( $1 = deop ) { mode # -o $2 }
  if ( $1 = halfop ) { mode # +h $2 }
  if ( $1 = dehalfop ) { mode # -h $2 }
  if ( $1 = voice ) { mode # +v $2 }
  if ( $1 = devoice ) { mode # -v $2 }
}
alias umode {
  if ($1 == ban) && ($2) {
    if ($address($2,2)) { mode # +b $address($2,2) }
    else { mode # +b $2 }
  }
  if ($1 == unban) && ($2) {
    if ($address($2,2)) { mode # -b $address($2,2) }
    else { mode # -b $2 }
  }
  if ($1 == kick) && ($2) {
    if ($address($2,2)) { kick # $2 $3 }
  }
  if ($1 == kickban) && ($2) {
    if ($address($2,2)) {
      mode # +b $address($2,2)
      kick # $2 $3
    }
  }
}

/cmode /mode # $1 
/spam /mode # +m
/nspam /mode # +N
/kspam /mode # +Q
/dcmode /mode # - $+ $1 
/dspam /mode # -m
/dnspam /mode # -N
/dkspam /mode # -Q
 Respond  
ToySoldier   -  Jul 24, 2007

Hmmz,

when i sed if ( $2 = Aop ) i ment if i type:

/adduser aop nick

 Respond  
Olliegod   -  Jul 24, 2007

In regards to the question about

/adduser {
if ( $2 = aop ) /command

I believe a working version would be

/adduser {
if ( $2 isop # ) /command
 Respond  
peterpowell   -  Jul 24, 2007

hi,

make these remote aliases

change: /owner /mode # +q $1

to: alias owner mode # +q $$1

etc..

-pp

 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.