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 

!ignore <nick> script
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
SIrJoKer
Voice


Joined: 06 Aug 2009
Posts: 7

PostPosted: Sun Jun 20, 2010 10:26 am    Post subject: Reply with quote

Nice work guys !
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Tue Aug 03, 2010 10:09 pm    Post subject: Reply with quote

dani wrote:
work fine!!! but i need a simple functions.. and i dont know how..

1. only ops use this command
2. ignore permanent, with out $time (third possibility)

3. can ignore a nick for a part? ex. amigo_***
where * is anything.

please help me and thanks mates. Smile


1.) the lines where it says:

Code:
bind pub - !ignore pub:cmdignore
bind pub - !unignore pub:cmdunignore


change that "-" to |o or o|o if you also want to allows those with global o flag to use the script.

2.) To make the ignore permanent, remove these lines:

Code:
if {![string match {[0-9]*} $time]} {set it "15m"} else {set it "$time"}
set time [lindex [split $text] 1]


and change:
Code:
newignore $im $handle "$ir" $it
to
Code:
newignore $im $handle "$ir" 0
and replace:
Code:
set reason [join [lrange [split $text] 2 end]]
with:
Code:
set reason [join [lrange [split $text] 1 end]]


As for question 3... I need a bit more info. it sounds to me like you want to turn nicks like amiigo_ into *amigo*!*. To do this, you'll need a string trim or regsub to trim away chars others than what you want, like:
Code:
set inick [regsub -all -- {[^a-z0-9]} $target ""]
This would remove all characters except for a-z and 0-9.

Then, you would need to change:
Code:
if {[onchan $target]} {set im "$target!*@*"} else {"set im $target"}
to
Code:
if {[onchan $target]} {set im "*$inick*!*@*"} else {"set im $target"}
.

I think that's what you want...
Back to top
View user's profile Send private message
dani
Voice


Joined: 18 Jun 2010
Posts: 5

PostPosted: Fri Aug 13, 2010 9:50 am    Post subject: Reply with quote

Luminous are u the best!! mate! 1 & 2 is perfect

As for question 3.. is like this: amigo_123 or amigo_can or amigo_was

_*** = anything the user wants

4. can i get a list of ignores nicks? how? public o priv..

Thank u very much! Very Happy
_________________
Sorry, my english is poor.
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Fri Aug 13, 2010 10:55 am    Post subject: Reply with quote

Okay, I made a few tweaks regarding how nicks are set. This -should- catch nicks like amigo_blah and just turn it into *amigo*!*, but I made it so that it will first attempt to ignore via their hostmask if they are on channel. If they are not, it uses the modified version of this nick.

I also added the ignorelist too. Syntax is !ignorelist.

I went ahead and wrote the whole thing out as one script. Ignorelist is at the end. Smile I fancied up the output of it for you some. Hope it works as planned, I wasn't able to test all of this in full, aside from the ignorelist.

Code:
bind pub o|o !ignore pub:cmdignore
bind pub o|o !unignore pub:cmdunignore
bind pub o|o !listignores listignores

proc pub:cmdignore {nick uhost handle channel text} {
 if {$text == ""} {return 0}
  if {[regexp -nocase -- {^[-_./\\]+?([a-z0-9]+)[-_./\\]+$} [lindex [split $text] 0] a b} {
 set target *$b*!*@*
  } else {
  set target [join [lindex [split $text] 0]]
   }
  set reason [join [lrange [split $text] 1 end]]
 set host [lindex [split [getchanhost $target $chan] @] 1]
        if {$reason == ""} {set ir "Requested By $nick on [join [ctime [unixtime]]]."} else {set ir "$reason Set By $nick on [join [ctime [unixtime]]]."}
       if {![string match *!*@* $target] && ![onchan $target]} {
        putserv "PRIVMSG $channel :invalid target; no such nickname/hostmask."
         return 0
        }
         if {[onchan $target]} {set im "*!*@*.[join [lrange [split $host .] end-2 end] .]"} else {"set im $target"}
          newignore $im $handle "$ir" 0
           putserv "PRIVMSG $channel :$nick, now ignoring $im for $it minutes."
            return 1
}

proc pub:cmdunignore {nick host handle channel text} {
 if {$text == ""} {return 0}
  set imask [lindex [split $text] 0]
   if {![isignore $imask]} {putserv "PRIVMSG $channel :invalid ignore $imask."; return 0}
    if {[killignore $imask]} {
     putserv "PRIVMSG $channel :$nick, no longer ingoring $imask."
      return 1
    } else {
     putserv "PRIVMSG $channel :failed, ignore $imask must be removed manually."
      return 0
    }
}

proc listignores {nick host hand chan text} {
 set ilist [ignorelist]
    if {![llength $ilist]} {
    putserv "NOTICE $nick :I am not currently ignoring anyone."
 return 0
    }
 set inum 0
    foreach i $ilist {
 set mask [join [lindex $i 0]]
 set reason [join [lindex $i 1]]
 set begin [join [clock format [lindex $i 3] -format %D-%T]]
 set end [join [clock format [lindex $i 2] -format %D-%T]]
        puthelp "NOTICE $nick :[incr inum]: \"$mask\" - Set at: $begin by [lindex $i end] for reason \"$reason\" - Ends at: $end"
    }
}
Back to top
View user's profile Send private message
RowdyOne
Voice


Joined: 24 Aug 2009
Posts: 3

PostPosted: Fri Jan 21, 2011 10:26 am    Post subject: Reply with quote

Using a botnet relay to connect this across 5 different networks. Using CrazyCat Chanrelay 3.0

Is this adaptable to work across the relay without a major rewrite?

Thank you in advance.

Rowdyone
Back to top
View user's profile Send private message
Jahner
Voice


Joined: 18 Feb 2011
Posts: 1

PostPosted: Fri Feb 18, 2011 1:45 pm    Post subject: Reply with quote

I created the ignore.tcl using the code Luminous created and am running eggdrop 1.6.20 and tcl 8.5.9

When I run !ignore user I receive this error:

Tcl error [pub:cmdignore: missing close-bracket
in expression "[regexp -nocase -- {^[-..."

Any thoughts or ideas? !unignore and !listignores work fine.

Any help is greatly appreciated
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Feb 19, 2011 4:17 am    Post subject: Reply with quote

That's because only the ignore uses the regexp. Just replace:
Code:

if {[regexp -nocase -- {^[-_./\\]+?([a-z0-9]+)[-_./\\]+$} [lindex [split $text] 0] a b}

with:
Code:

if {[regexp -nocase -- {^[-_./\\]+?([a-z0-9]+)[-_./\\]+$} [lindex [split $text] 0] a b]}

notice the ']' after 'b'.
_________________
Once the game is over, the king and the pawn go back in the same box.
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 Previous  1, 2
Page 2 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