Channel userlist - whos admin and helper

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

Channel userlist - whos admin and helper

Postby Cristian » Sun Sep 28, 2008 12:43 am

trigger - .staff
channel - #channel (use * for every channel)
method - privmsg or notice

admins and helpers information is gathered from eggdrop userlist
Admin flag are Channel n|m|o
Helper flag are Channel h|v
Exempt flag are b (only one flag)

Please report bugs and errors here.

Code: Select all
namespace eval staff {
   namespace eval variable {

      variable trigger ".staff"
      variable channel "#channel"
      variable method "privmsg"
      variable help "h|v"
      variable admin "n|m|o"
      variable exempt "b"
      
   }
   bind PUBM - "$::staff::variable::channel $::staff::variable::trigger*" [namespace current]::public
   proc public {nickname hostname handle channel arg} {
      if {![info exists nospam(variable.$channel)]} {
         set nospam(variable.$channel) 1; utimer 20 [list unset -nocomplain nospam(variable.$channel)]
         set admins ""
         set helpers ""

         foreach user [chanlist $channel $::staff::variable::admin] {
            if {[exclude $admins $user]} {
               lappend admins $user
            }
         }
         foreach user [chanlist $channel $::staff::variable::help] {
            if {[exclude $admins $user] == 1 && [exclude $helpers $user] == 1} {
               lappend helpers $user
            }
         }


         switch $::staff::variable::method {
            privmsg {
               if {[iswhat $admins]} {
                  putmsg $nickname "Admins: $admins"
               }
               if {[iswhat $helpers]} {
                  putmsg $nickname "Helpers: $helpers"
               }
            }
            notice {
               if {[iswhat $admins]} {
                  putnotc $nickname "Admins: $admins"
               }
               if {[iswhat $helpers]} {
                  putnotc $nickname "Helpers: $helpers"
               }
            }
         }
      }
   }
   proc iswhat {arg} {
      if {[llength $arg] > 0} {
         return 1
      }
      return 0
   }
   proc exclude {arg1 arg2} {
      if {[lsearch $arg1 $arg2] != -1} { return 0 }
      if {[string length $arg2] == 1} { return 0 }
      if {[lsearch [split [chattr [nick2hand $arg2]] ""] $::staff::variable::exempt] != -1} { return 0 }
      return 1
   }
}
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Return to TCL Scripting Release

Who is online

Users browsing this forum: No registered users and 3 guests

cron