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.

Public Command Script

Old posts that have not been replied to for several years.
Locked
User avatar
Clipped
Halfop
Posts: 73
Joined: Fri Jan 24, 2003 2:27 am

Public Command Script

Post by Clipped »

Im having some problems with this script :) I made some edits and it works but I would like to make it so the bot will not founder or admin anyone but a bot owner. Here is part of code.

Code: Select all

proc founder {nick host hand chan text} {
  if {$text == ""} {
  	putquick "MODE $chan +q $nick"
	putlog "#$hand# has founder themselves in $chan"
  } else {
  	set foundernick [lindex $text 0]
  	putquick "MODE $chan +q $foundernick"
  	putlog "#$hand# has founder $foundernick in $chan"
  	
  }
}
This works..ie
!founder
or !founder nick

the problem is with the second command. Any of the current owners can !founder nick and the bot will founder them. I would like it to only be able to founder a nick witht the n flag.

This part works perfect but im confused on how to to reverse it..heh

Code: Select all

proc defounder {nick host hand chan text} {
  if {$text == ""} {
  	putquick "MODE $chan -q $nick"
	putlog "#$hand# has defoundered themselves in $chan"
  } else {
  	set defoundernick [lindex $text 0]
  	if {[matchattr $defoundernick n]} {
  		putserv "NOTICE $nick :This user is the bot owner, so you can't defounder them."
  	} elseif {[isbotnick $defoundernick]} {
  		putserv "NOTICE $nick :I doubt it...   =D"
  	} else {  
  		putquick "MODE $chan -q $defoundernick"
  		putlog "#$hand# has deoped $defoundernick from $chan"
  	}
  }
}

As a side note this forum style is extremely well done.Ppslim did a very nice job with it..

Clipped
r
ribot
Voice
Posts: 17
Joined: Mon Sep 08, 2003 4:01 pm
Location: eggbeer
Contact:

Post by ribot »

it seems to me that you dont want to founder a nick that isnt +n, so why in that case make a defounder function for that?

shouldn't something like this be put in the first script:
if {[matchattr $foundernick n]} { putquick "MODE $chan +q $nick" }

or even simpler, why not just make the bind respond to +n users?
bind pubm n !founder proc
User avatar
Clipped
Halfop
Posts: 73
Joined: Fri Jan 24, 2003 2:27 am

Post by Clipped »

I actually binded it to a User defined flag. The problem is not with users using the founder command itself.The bot will not respond to users who do not have the flag.The problem im having is that I had a few instances where a peep that has the flag(Is allowed to use the !founder and !admin command) has mistakenly typed !founder nick(Who should not be founder)
heh make sense ?

I was hoping there was a way to make the bot check to see if the user being foundered has the user defined flag before it +q or +a.

ie

!founder Billy

The bot checks to see if Billy has the user defined flag or owner flag.If so it +q them if not it states this user is not a bot owner.

Im confused now even more..heh


The defounder is for admins etc that /away they can !defounder before they set away.

Clipped
User avatar
Clipped
Halfop
Posts: 73
Joined: Fri Jan 24, 2003 2:27 am

Post by Clipped »

! :o
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Like ribot said, use 'matchattr' to determine if the user has the right flags, but flags belong to HANDLES, not nicks. To find the handle from a nick use 'nick2hand', which will return * if no matching user is found (making 'validuser' return 0)...so something like this should do it:

Code: Select all

set founder_flags nF|nF
bind pub $founder_flags !founder founder
proc founder {n u h c a} {
	if {[string len $a]} {
		if {[onchan $a $c]&&[validuser [nick2hand $a]]} {
			if {[matchattr [nick2hand $a] $::founder_flags $c]} {
				putserv "MODE $c +q $a"
				putlog "#$hand# foundered $a in $c"
			} {
				putserv "PRIVMSG $c :$a doesn't deserve it :)"
			}
		} {
			putserv "PRIVMSG $c :$a who?"
		}
	} {
		putserv "MODE $c +q $n"
		putlog "#$hand# foundered him/her self in $c"
	}
}
Have you ever read "The Manual"?
User avatar
Clipped
Halfop
Posts: 73
Joined: Fri Jan 24, 2003 2:27 am

Post by Clipped »

I found this also worked..

Code: Select all

proc founder {nick host hand chan text} {
  if {$text == ""} {
  	putquick "MODE $chan +q $nick"
	putlog "#$hand# has founder themselves in $chan"
  } else {
  	set foundernick [lindex $text 0]
	if {[matchattr $foundernick n]} { 
  	putquick "MODE $chan +q $foundernick"
  	putlog "#$hand# has founder $foundernick in $chan"
  	}
  }
}
There is simply no response if the nick does not have n flag...which is ok.

I got rid of the userdefine flag for the proc..n is easier..

Thanks guys

Clipped
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Clipped wrote:I found this also worked..
Only because...
* the nick did not contain special chars that would make 'lindex' choke on the _string_ recieved from irc
* the nick was == the handle of some existing user
* the nick was on the channel

If one of these conditions are not met, your script will either generate a error message or do nothing but log a message about setting mode +q on someone that are not even on the channel :)
Have you ever read "The Manual"?
User avatar
Clipped
Halfop
Posts: 73
Joined: Fri Jan 24, 2003 2:27 am

Post by Clipped »

Heh you are correct..Just tested ;)

I'm using your code now :)

Thanks
Locked