This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Adding exceptions to AbuseReport by BlackShadow

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Adding exceptions to AbuseReport by BlackShadow

Post by LoKii »

Hello everyone,

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

Code: Select all

########################################################################
#                            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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

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: Select all

########################################################################
#                            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"
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

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 :)

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 :)

Cheers.
Post Reply