egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding exceptions to AbuseReport by BlackShadow

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Mon Mar 11, 2013 3:26 pm    Post subject: Adding exceptions to AbuseReport by BlackShadow Reply with quote

Hello everyone,

Need a little help in editing this script made by BlackShadow.

Code:
########################################################################
#                            AbuseReport 1.0
#
#This TCL shows the channel where the bot has problems
#!report abused ( shows the channels where the bot is not on chan )
#!report deoped ( shows the channels where the bot has no op )
#!report users ( shows the channels where the limit of the users is not # achived. You can set the limit of users in the TCL)
#
#                                 BLaCkShaDoW ProductionS
#######################################################################


#Here you can set the first char of the command

set report(char) "~"

#Here you set the limit of users. If a chan doesent have a number a #users higher than the one you set , you will see the chan on #executing the !report users command 

set report(minusers) "15"

#Here you can set the flags to use this command

set report(flags) "n"


#######################################################################
setudef flag report
setudef flag chanserv
bind pub $report(flags) $report(char)report reporting

proc reporting {nick host hand chan arg} {
    if {(![authed $hand])} {return 0}
global report botnick
set sta ""
set ::chan $chan
set ew [lindex [split $arg] 0]
set number [llength [channels]]
if {[channel get $chan report]} {
if {$arg == ""} { puthelp "NOTICE $nick :Please use : $report(char)report <abused> | <deoped> | <users> ."
return 0
}

if {([regexp -nocase -- {(#[0-9]+|abused|deoped|users)} $ew tmp reported]) && (![regexp -nocase -- {\S#} $ew])} {
    switch $reported {

 abused {
foreach c [channels] {
if {[onchan $botnick $c]} {set sta 1} else { lappend ab $c }
}

if {[info exists ab]} {
puthelp "PRIVMSG $chan :I am not on this channels :\002[join $ab ", "]\002."
} else {
puthelp "PRIVMSG $chan :I dont have any chan in my list."
}
}

deoped {
foreach c [channels] {
if {[onchan $botnick $c]} {
if {[botisop $c]} { set sta 1 } else { lappend noopchans $c }
}
}
if {[info exists noopchans]} {
puthelp "PRIVMSG $chan :Channels where i am not OP are: \002[join $noopchans ", "]\002."
} else {
puthelp "PRIVMSG $chan :I dont have any chan in my list"
}
}

users {
foreach c [channels] {
if {[onchan $botnick $c]} {
set usersnumber [llength [chanlist $c]]
if {$usersnumber < $report(minusers)} {
lappend minuserschans $c
}
}
}
if {[info exists minuserschans]} {
puthelp "PRIVMSG $chan :The channels with a number of users lower than $report(minusers) are: \002[join $minuserschans ", "]\002."
} else {
puthelp "PRIVMSG $chan :I dont have any chan in my list."
}
}
}
}
}
}

putlog "AbuseReport Tcl 1.0 by BLaCkShaDoW Loaded"


What I'm trying to do is to add an exception list for some channels that i would specify, only for the part report users. (Thats the part where it reports if the minimum user count on channels is below a set value.)

I have tried to set a list of channels, and then to let the script perform an lsearch with a foreach when i realized, that I had no idea how to make exempts. :p

If this is not too complicated, i would appreciate some help on this.

Cheers everyone.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Mon Mar 11, 2013 6:20 pm    Post subject: Reply with quote

Try this code

Use .chanset #channel +except for the channel you don`t want the bot to act on and see if its what you wanted

Code:
########################################################################
#                            AbuseReport 1.0
#
#This TCL shows the channel where the bot has problems
#!report abused ( shows the channels where the bot is not on chan )
#!report deoped ( shows the channels where the bot has no op )
#!report users ( shows the channels where the limit of the users is not # achived. You can set the limit of users in the TCL)
#
#                                 BLaCkShaDoW ProductionS
#######################################################################


#Here you can set the first char of the command

set report(char) "~"

#Here you set the limit of users. If a chan doesent have a number a #users higher than the one you set , you will see the chan on #executing the !report users command

set report(minusers) "15"

#Here you can set the flags to use this command

set report(flags) "n"

setudef flag except


#######################################################################
setudef flag report
setudef flag chanserv
bind pub $report(flags) $report(char)report reporting

proc reporting {nick host hand chan arg} {
   if {(![authed $hand])} {return 0}
   global report botnick
   set sta ""
   set ::chan $chan
   set ew [lindex [split $arg] 0]
   set number [llength [channels]]
   if {[channel get $chan report]} {
      if {$arg == ""} { puthelp "NOTICE $nick :Please use : $report(char)report <abused> | <deoped> | <users> ."
         return 0
      }

      if {([regexp -nocase -- {(#[0-9]+|abused|deoped|users)} $ew tmp reported]) && (![regexp -nocase -- {\S#} $ew])} {
         switch $reported {

            abused {
               foreach c [channels] {
                  if {[onchan $botnick $c]} {set sta 1} else { lappend ab $c }
               }

               if {[info exists ab]} {
                  puthelp "PRIVMSG $chan :I am not on this channels :\002[join $ab ", "]\002."
               } else {
                  puthelp "PRIVMSG $chan :I dont have any chan in my list."
               }
            }

            deoped {
               foreach c [channels] {
                  if {[onchan $botnick $c]} {
                     if {[botisop $c]} { set sta 1 } else { lappend noopchans $c }
                  }
               }
               if {[info exists noopchans]} {
                  puthelp "PRIVMSG $chan :Channels where i am not OP are: \002[join $noopchans ", "]\002."
               } else {
                  puthelp "PRIVMSG $chan :I dont have any chan in my list"
               }
            }

            users {
               foreach c [channels] {
                  if {![channel get $c except]} {
                     if {[onchan $botnick $c]} {
                        set usersnumber [llength [chanlist $c]]
                        if {$usersnumber < $report(minusers)} {
                           lappend minuserschans $c
                        }
                     }
                  }
               }
               if {[info exists minuserschans]} {
                  puthelp "PRIVMSG $chan :The channels with a number of users lower than $report(minusers) are: \002[join $minuserschans ", "]\002."
               } else {
                  puthelp "PRIVMSG $chan :I dont have any chan in my list."
               }
            }
         }
      }
   }
}

putlog "AbuseReport Tcl 1.0 by BLaCkShaDoW Loaded"

_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Tue Mar 12, 2013 2:07 am    Post subject: Reply with quote

Sweet, this is EXACTLY what I was looking for.

I should have though of a setudef solution too, but my mind was lost in if this chan then that chan and search chanlists bla bla bla.

Thank you very much Madalin Smile

Be sure that your name (and others here who have helped me) will be given proper credits in the final project for all your support Smile

Cheers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber