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.

Kick specific user on word

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Kick specific user on word

Post by starpossen »

What im asking is, if a user says a word specified in the script or a txt file, it will kick him or her, like so:

Nick says noob
Bot then kicks the user
But only the user with the specified nick in the script or txt file.

Is this difficult to do, or am I requesting something stupid?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Not necessarily hard to do.. You'd just have 2 different lists, and do a test to AND them together.. Maybe I'll cobble something together for you (unless someone else wants to do it :)
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Much appriciated.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

So if I understand right, there should be a nick-list and a word-list. If someone whose nick is in the nick-list says a word from the word-list he should get kicked?
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Exactly, sorry if I messed up my explanation.
Maybe a predefined reason could be added to the kick?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Put in an option to add/remove nicks and words from within the script too and save em in a file.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

I like the ideas alot, but im still to n00bish but im reading alot thus no fan of reading, I do however takes notes of everything I can, so im looking forward to see the result of this one.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Sorry for being eager, just wanted to hear if the script is being worked on :)
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

I assumed sir_fz was gonna make it. If he says he's not, I'll throw one together for you in a few days.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I didn't promise to do it but oh well...

Code: Select all

# wordlist location
set wlloc scripts/wordlist.txt

# nicklist location
set nlloc scripts/nicklist.txt

bind pubm - * kickifnick
bind DCC n addnick [list addtolist nicklist]
bind DCC n addword [list addtolist wordlist]
bind DCC n delnick [list delfromlist nicklist]
bind DCC n delword [list delfromlist wordlist]
bind time ?0* savelists

if {[file exists $wlloc]} {
 set wordlist [split [read [set fwl [open $wlloc]]] \n][close $fwl]
} { set wordlist [list] }

if {[file exists $nlloc]} {
 set nicklist [split [read [set fwl [open $wlloc]]] \n][close $fwl]
} { set nicklist [list] }

proc kickifnick {nick uhost hand chan arg} {
 global wordlist nicklist
 if {[lsearch -exact $nicklist [string tolower $nick]] != -1} {
  set f 0
  foreach w $wordlist {
   if {[string match -nocase $w [string tolower $arg]]} {
    set f 1
    break
   }
  }
  if {$f} {
   putserv "kick $chan $nick :Bad word detected..."
   putserv "mode $chan +b *!*@[lindex [split $uhost @] 1]"
  }
 }
}

proc addtolist {t hand idx arg} {
 upvar $t list
 if {[lsearch -exact $list [string tolower $arg]] == -1} {
  lappend list [string tolower $arg]
  putdcc $idx "Successfully added $arg to $t."
 } {
  putdcc $idx "$arg already exists in $t."
 }
}

proc delfromlist {t hand idx arg} {
 upvar $t list
 if {[set i [lsearch -exact $list [string tolower $arg]]] != -1} {
  set list [lreplace $list $i $i]
  putdcc $idx "Successfully deleted $arg from $t."
 } {
  putdcc $idx "$arg does not exists in $t."
 }
}

proc savelists args {
 global nicklist wordlist nlloc wlloc
 set f1 [open $nlloc w]
 set f2 [open $wlloc w]
 foreach n $nicklist w $wordlist {
  if {$n != ""} { puts $f1 $n }
  if {$w != ""} { puts $f2 $n }
 }
 close $f1
 close $f2
}
To add words/nick use DCC command .addword and .addnick. To remove, use .delword and .delnick.

Not tested.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

I just tested it, and it works exactly as I wanted it to, now I have a few requests to add to the script if possible:

Public command for adding word and nick (ofcourse keep the dcc ones)
Define channel in which the action should be taken in (via dcc or public command)
Maybe a warning before kick, and a second warning, then ban.

I don't know if this is too much to ask, but I hope it would be possible.
Once again, thanks for helping out.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

"Do it yourself"

It wouldn't hurt people to try something once in awhile. You can almost exactly copy the DCC code and change some things so it is MSG related.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

metroid wrote:"Do it yourself"

It wouldn't hurt people to try something once in awhile. You can almost exactly copy the DCC code and change some things so it is MSG related.
Nice way to post to a newb, and I wouldnt be posting in a request section if I knew the stuff mtself, now would I?

Anyways, after been made fun of, I tried this:

Code: Select all

bind pubm - * kickifnick
bind pub n .addnick [list addtolist nicklist]
bind pub n .addword [list addtolist wordlist]
bind pub n .delnick [list delfromlist nicklist]
bind pub n .delword [list delfromlist wordlist]
Ofcourse it didn't work, hence why I asked for help making it, the errors I got is:

Code: Select all

Tcl error [addtolist t hand idx arg]: wrong # args: should be "addtolist t hand idx arg"
And yes errors codes are to most, often selfexplaining, but im getting confused now, so if someone would help me out I would appriciate a good answer.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: used for commands given on a channel. The first word
becomes the command and everything else is the text argument.
Module: irc
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Yeah I read that, but I am so lost now, still reading though.
Post Reply