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.

!deluser is not working if nick is not on chan

Support & discussion of released scripts, and announcements of new releases.
Post Reply
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

!deluser is not working if nick is not on chan

Post by eXtremer »

<@eXtremer> !deluser nick
-Bot- Sorry, but I don't see nick in #testing.

Code: Select all

### !DELUSER <nick>

proc pub_lol_deluser {me b c chan arg} {
	set arg [charfilter $arg]
	global lol botnick
	if {![check $c $me $b]} {
		if {$lol(silent) == 1 || [checksilent $c]} {return 0}
            puthelp "NOTICE $me :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
		return 0
	}
	if {[llength $arg] != 1} {
		puthelp "NOTICE $me :\002Usage:\002 [string trim $lol(cmdchar)]deluser <nick>"
		return 0
	}
	set nick [lindex $arg 0]
	set bot [strlwr $botnick]
	set hand [nick2hand $nick $chan]
	if {![onchan $nick $chan]} {
            puthelp "NOTICE $me :Sorry, but I don't see $nick in $chan."
		return 0
	}
	if {[strlwr $nick] == $bot} {
            puthelp "NOTICE $me :Yeah right, like I'm going to let you delete ME!"
		return 0
	}
	if {[getting-users]} {
            puthelp "NOTICE $me :Sorry, but I'm transferring the userfile, try later."
		return 0
	}
	if {![validuser $hand]} {
		puthelp "NOTICE $me :$nick is not a registered user."
		return 0
	}
	if {[matchattr $hand n]} {
		puthelp "NOTICE $me :You can't delete a bot owner."
		return 0
	}
	deluser $hand
	boot $hand "You have been deleted"
      puthelp "NOTICE $me :$nick has been removed from the userlist."
      puthelp "NOTICE $nick :You have been removed from the userlist by $me."
	if {[botisop $chan]} {pushmode $chan -o $nick}
	return 0
}

Is it possible to delete a username even if he is not on the channel ?!
Thanks in advance.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Use the native .-user command from the dcc partyline.
NML_375
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

nml375 wrote:Use the native .-user command from the dcc partyline.
I know about the .-user partyline command, but there are local Owners that don't have acc to partyline (Only me, for security reasons & other..) that can't delete a user, so I need this pub cmd to work.
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

The same question...maybe someone knows how to fix it ? Or at least give me another code (script) that will work as I wish.
Thank you.
User avatar
BLaCkShaDoW
Op
Posts: 120
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

Re: !deluser is not working if nick is not on chan

Post by BLaCkShaDoW »

eXtremer wrote:<@eXtremer> !deluser nick
-Bot- Sorry, but I don't see nick in #testing.

Code: Select all

### !DELUSER <nick>

proc pub_lol_deluser {me b c chan arg} {
	set arg [charfilter $arg]
	global lol botnick
	if {![check $c $me $b]} {
		if {$lol(silent) == 1 || [checksilent $c]} {return 0}
            puthelp "NOTICE $me :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
		return 0
	}
	if {[llength $arg] != 1} {
		puthelp "NOTICE $me :\002Usage:\002 [string trim $lol(cmdchar)]deluser <nick>"
		return 0
	}
	set nick [lindex $arg 0]
	set bot [strlwr $botnick]
	set hand [nick2hand $nick $chan]
	if {![onchan $nick $chan]} {
            puthelp "NOTICE $me :Sorry, but I don't see $nick in $chan."
		return 0
	}
	if {[strlwr $nick] == $bot} {
            puthelp "NOTICE $me :Yeah right, like I'm going to let you delete ME!"
		return 0
	}
	if {[getting-users]} {
            puthelp "NOTICE $me :Sorry, but I'm transferring the userfile, try later."
		return 0
	}
	if {![validuser $hand]} {
		puthelp "NOTICE $me :$nick is not a registered user."
		return 0
	}
	if {[matchattr $hand n]} {
		puthelp "NOTICE $me :You can't delete a bot owner."
		return 0
	}
	deluser $hand
	boot $hand "You have been deleted"
      puthelp "NOTICE $me :$nick has been removed from the userlist."
      puthelp "NOTICE $nick :You have been removed from the userlist by $me."
	if {[botisop $chan]} {pushmode $chan -o $nick}
	return 0
}

Is it possible to delete a username even if he is not on the channel ?!
Thanks in advance.
You should remove this :

Code: Select all

if {![onchan $nick $chan]} { 
            puthelp "NOTICE $me :Sorry, but I don't see $nick in $chan." 
      return 0 
   } 
BLaCkShaDoW Production @ WwW.TclScripts.Net
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Re: !deluser is not working if nick is not on chan

Post by eXtremer »

BLaCkShaDoW wrote:You should remove this :

Code: Select all

if {![onchan $nick $chan]} { 
            puthelp "NOTICE $me :Sorry, but I don't see $nick in $chan." 
      return 0 
   } 
I removed the lines but now the Bot says that the User I want to delete is not a registered one =>

DCC:
.userlist +o #chan
List of my users : Enigma ClubH0uSe ReSpEkT Bastty- sAd\\ monck dns AndreuLs Semafoare ZyklonB kid^ Igorash Pisi` desc MrKry Nicushor W1nd0ws op mira- Aycha

On chan:
<+Me> !deluser Enigma
-Bot- Enigma is not a registered user.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

It's related to this line:

Code: Select all

set hand [nick2hand $nick $chan]
In order for eggdrop to convert a nickname into a handle, it needs to "see" the nickname => that is, the nickname has to be on a channel your eggdrop is monitoring. Further, this code tells your eggdrop to only look in the channel where the command was issued. Since the nickname is not there, this will return "*" indicating no such user... And the script will abort.

You could try removing the channel parameter on that line, but even so, this code would only work if the nickname is seen in one of your eggdrop's channels...
NML_375
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

nml375 wrote:It's related to this line:

Code: Select all

set hand [nick2hand $nick $chan]
In order for eggdrop to convert a nickname into a handle, it needs to "see" the nickname => that is, the nickname has to be on a channel your eggdrop is monitoring. Further, this code tells your eggdrop to only look in the channel where the command was issued. Since the nickname is not there, this will return "*" indicating no such user... And the script will abort.

You could try removing the channel parameter on that line, but even so, this code would only work if the nickname is seen in one of your eggdrop's channels...
Understood nml375, thank you 4 exaplaining...but there has to be a way to fix the script. Nobody knows how to ? Or can smb give me another code ?
User avatar
BLaCkShaDoW
Op
Posts: 120
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

Post by BLaCkShaDoW »

eXtremer wrote:
nml375 wrote:It's related to this line:

Code: Select all

set hand [nick2hand $nick $chan]
In order for eggdrop to convert a nickname into a handle, it needs to "see" the nickname => that is, the nickname has to be on a channel your eggdrop is monitoring. Further, this code tells your eggdrop to only look in the channel where the command was issued. Since the nickname is not there, this will return "*" indicating no such user... And the script will abort.

You could try removing the channel parameter on that line, but even so, this code would only work if the nickname is seen in one of your eggdrop's channels...
Understood nml375, thank you 4 exaplaining...but there has to be a way to fix the script. Nobody knows how to ? Or can smb give me another code ?
just replace [nick2hand $nick $chan] with [nick2hand $nick] and it will work :P
BLaCkShaDoW Production @ WwW.TclScripts.Net
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Blackshadow, it will only work under certain conditions, as mentioned in my previous post.

If we exclude the case of the user not being online at all, an "all case" solution would require a who/whois-request for the nickname in question, parsing of the response.

This would then have to be used to search the userlist for a match, which finally would be used to remove the user record.

This kind of scripting requires caution however, as you'd end up using raw bindings - and if not done properly, will screw up your eggdrop.

A much simpler approach would be to require the operator to know the handle rather than the nickname, as we wouldn't have to bother with various lookups...
NML_375
Post Reply