egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Kick specific user on word
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sat Dec 09, 2006 10:36 pm    Post subject: Kick specific user on word Reply with quote

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?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sat Dec 09, 2006 11:00 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun Dec 10, 2006 12:09 am    Post subject: Reply with quote

Much appriciated.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 10, 2006 9:20 am    Post subject: Reply with quote

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?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun Dec 10, 2006 12:32 pm    Post subject: Reply with quote

Exactly, sorry if I messed up my explanation.
Maybe a predefined reason could be added to the kick?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Dec 10, 2006 2:29 pm    Post subject: Reply with quote

Put in an option to add/remove nicks and words from within the script too and save em in a file.
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Mon Dec 11, 2006 7:23 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sat Dec 16, 2006 8:08 am    Post subject: Reply with quote

Sorry for being eager, just wanted to hear if the script is being worked on Smile
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sat Dec 16, 2006 4:23 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 17, 2006 9:13 am    Post subject: Reply with quote

I didn't promise to do it but oh well...
Code:
# 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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun Dec 17, 2006 1:56 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Dec 17, 2006 3:19 pm    Post subject: Reply with quote

"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.
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun Dec 17, 2006 5:54 pm    Post subject: Reply with quote

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:

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:

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.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 17, 2006 6:28 pm    Post subject: Reply with quote

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

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun Dec 17, 2006 7:12 pm    Post subject: Reply with quote

Yeah I read that, but I am so lost now, still reading though.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber