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.

Deleting all users in a userfile

Old posts that have not been replied to for several years.
Locked
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Deleting all users in a userfile

Post by stevegarbz »

Is there a way to mass delete ALL the users in the userfile? I don't want to do 160 deletes seperate because some idiot didn't know what he was doing?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

.tcl foreach u [userlist] {if {$u != "yourbothandle"} {deluser $u}}
.save
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Or you can also do it manually which I prefer. Kill the bot at first. In the shell dir /eggdrop open up the .user file, via pico or download it onto your hard disk.

Delete all the lines which say --HOSTS as well the ones which mention the users flags and handles. Then upload the file back, or if you are doing it on your shell save it via pico or the editor you are using. Reload the bot back in the background and DCC to it and type .save, that should do it manually.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

stevegarbz wrote:I don't want to do 160 deletes seperate because some idiot didn't know what he was doing?
Miss something? No one in their right mind would want to sit down and do that rubbish "manually". :P
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
k
kic
Voice
Posts: 3
Joined: Mon Jan 10, 2005 7:13 pm
Contact:

Re: Deleting all users in a userfile

Post by kic »

stevegarbz wrote:Is there a way to mass delete ALL the users in the userfile? I don't want to do 160 deletes seperate because some idiot didn't know what he was doing?
1.) connect to your shell account.
2.) bring your bot offline with: .die in dcc chat
3.) locate your bots userfile on your shell
3.) delete the userfile altogether: rm -rf userfile
4.) restart your bot with the -m switch
5.) go to IRC and msg your bot 'hello'

You will now have a clean userfile, with you being the only user on the box. This is cleaner than opening the userfile directly with pico and removing lines, and then overwriting. You will avoid possible file corruption this way.
-kic
bling
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

That's totally deleting the user file and creating a new one. I think no one would do that, because they would have to add themselves, their flags etc and owner settings back in again. Only remove all the other users, except yourself which is obvious. :P
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
k
kic
Voice
Posts: 3
Joined: Mon Jan 10, 2005 7:13 pm
Contact:

Post by kic »

awyeah wrote:That's totally deleting the user file and creating a new one. I think no one would do that, because they would have to add themselves, their flags etc and owner settings back in again. Only remove all the other users, except yourself which is obvious. :P
You do not have to add yourself, flags, owner status, etc.
When you /msg the bot hello again it will do all of that for you automatically.

His question was how to delete ALL of the users in the userfile, and that is the best way to do it.

regards,
-kic
bling
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

foreach user [userlist] { 
if {![matchattr $user n]} { deluser $user }
}
Would delete all users except the owners. :\
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

oops, didn't see this was an old topic. I haven't logged in awhile it seems :p
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

MeTroiD wrote:

Code: Select all

foreach user [userlist] { 
if {![matchattr $user n]} { deluser $user }
}
Would delete all users except the owners. :\
I have been toying with the above and have so far come up with the following:

Code: Select all

set userdel(trigger) "$::botnick"
set cmdchar_ "!"
proc cmdchar { } {global cmdchar_; return $cmdchar_}

bind pub - [cmdchar]$userdel(trigger) pub_userdel

proc pub_userdel {nick uhost hand chan rest} {
    global userdel
    set rest [stripcodes bcruag $rest]
    if {![matchattr $hand n]} {sendnotc "notice $nick :I don't like you."; return}

    set cmd [strlwr [lindex $rest 0]]

    if {[string match {userdel} $cmd]} {
        set thechan [strlwr [lindex $rest 1]]
        if {$thechan != ""} {
            set thechan [chanaddapt $thechan]
        } elseif {$thechan == ""} {
            set thechan $chan
        }
        if {![validchan $thechan]} {sendnotc "notice $nick :I'm not on $thechan."; return}
        sendnotc "notice $nick :\002***\002 Deleting user list of $thechan \002***"
            if {[userlist $thechan] == ""} {
		    sendnotc "notice $nick :No Entries."
	    } else {
		    foreach user [userlist |nmov $thechan] {
		        if {[matchattr $user bof]} { continue }
			    deluser $user
	            }}
	sendnotc "notice $nick :\002*** Users deleted! ***"
    } else {sendnotc "notice $nick :Error! Use: $::cmdchar_$userdel(trigger) userdel \[channel\]."; return}
}

# chanaddapt - checks channel name and adds # if needed.

proc chanaddapt {chan} {
	if {[string index $chan 0] != "#" && [string index $chan 0] != "&"} {
		set newchan #$chan
		return $newchan
	}
	return $chan
}
# end chanaddapt

proc sendnotc {text} {

    putquick "$text"
}
Now, although the above works as expected, what I would really like to be able to do is delete the users of a particular channel without having to rely on flags i.e after the bot has been removed from a channel. I would also like to be able to do the flag checking bit if the bot is still in the targeted channel.

I've been running around in circles trying to achieve this to no avail.

Is it possible?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked