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.

Spam

Help for those learning Tcl or writing their own scripts.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

That's an error-message, saying there's a syntactical error in the script.
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

Fixed this error and now:

Code: Select all

[19:22] Tcl error [pv_kick2]: invalid command name "# join channel klik www pussy http"
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

#Antispam With cycle command

# -> bantime
set bantime 30

# -> banned words
set bannedwords "# join channel klik www pussy http" 

# -> minutes bot should cycle channels
set timecycle 1



# SCRIPT BEGINS
bind msgm - "*" pv_kick2

# kick
proc pv_kick2 {nick uhost hand text} {
   foreach bword [split $bannedwords]
      foreach word [split $text] {
         if {[string match -nocase [string tolower $bword]  [string tolower $word]]} {
            set banthisguy 1 ; break ; break
         }
      }
   }
   if {[info exists banthisguy]} {
      foreach pvchan2 [channels] {
         if {![isop $nick $pvchan2] && ![isvoice $nick $pvchan2] && [onchan $nick $pvchan2]} {
            set pvmask2 "*!*$uhost"
            if {![ischanban $pvmask2 $pvchan2]} {
               set pvkickmsg2 "\002Msg Spam 30min. Ban!"
               newchanban $pvchan2 $pvmask "Anti-Spam" $::pvkickmsg2 "%0d0h30m"
            } 
         }
      }
   }
}

# cycle
timer $timecycle part_chan
proc part_chan {} {
   global timecycle
   foreach chancycle [channels] {
      putserv "PART $chancycle :\037Spam Check!\037"
   }
   timer $timecycle part_chan
}
# SCRIPT ENDS
That was me trying to write code without having to involve the bot. LMFAO :lol:
The script above was tested, loaded into my bot, and immediately banned my clone which spammed it, so seems to work. Traded out that lsearch, which wouldve been nice and eliminated a foreach, but it wasn't working as expected.. keke
Last edited by speechles on Sat Jul 05, 2008 12:25 pm, edited 2 times in total.
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

asd
Last edited by asdd1 on Sat Jul 05, 2008 1:41 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@Speechles: A hint, add a "break" to the bword foreach-loop when the test evaluates to true, and you don't have to test all the other patterns as you already have a match..

Or just do it like this:

Code: Select all

proc pv_kick2 {nick uhost hand text} {
 foreach bword [split $::bannedwords] {
  if {[string match -nocase "*$bword*" $text]} {
   foreach pvchan2 [channels] {
    if {[onchan $nick $pvchan2] && ![isop $nick $pvchan2] && ![isvoice $nick $pvchan2]} {
     set pvmask2 "*!*$uhost"
     if {![ischanban $pvmask2 $pvchan2]} {
      newchanban $pvchan2 $pvmask "Anti-Spam" "\002Msg Spam 30min. Ban!" "%0d0h30m"
     }
    }
   }
   break
  }
 }
} 
Last edited by nml375 on Sat Jul 05, 2008 12:46 pm, edited 1 time in total.
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

asd
Last edited by asdd1 on Sat Jul 05, 2008 1:42 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

asdd1 wrote:

Code: Select all

[19:23] Tcl error in file 'eggdrop.conf':
[19:23] invalid command name "}"
while executing
"}"
(file "scripts/Advertise.TCL" line 37)
invoked from within
"source scripts/Advertise.TCL"
(file "eggdrop.conf" line 117)
[19:23] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
:(
This is due to this line:

Code: Select all

 foreach bword [split $bannedwords]
Change it to this, and you'll fix this error and another one...

Code: Select all

 foreach bword [split $::bannedwords] {
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

Ok, fixed, but my spam isn't detected ;(
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

asdd1: If you're using the piece of code posted by me, it's meant to replace the pv_kick2 in the script posted by speechles.

Regardless which you use, you'll need to set the variable bannedwords to a list of "badwords".
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

nml375 wrote:asdd1: If you're using the piece of code posted by me, it's meant to replace the pv_kick2 in the script posted by speechles.

Regardless which you use, you'll need to set the variable bannedwords to a list of "badwords".
I'm using the speechles variant and it doesnt detect :(.
Regardless which you use, you'll need to set the variable bannedwords to a list of "badwords".
What you mean ?
Last edited by asdd1 on Sat Jul 05, 2008 12:50 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

asdd1 wrote:Ok, fixed, but my spam isn't detected ;(
The change to using newchanban requires that you configured your bot to enforce bans on the channel(s) (.chanset #thechannel +enforcebans), and it will not kick or ban people identified as friends (or op if set +dontkickops) or masters/owners. Could you doublecheck these conditionals with your test bench?
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

asd
Last edited by asdd1 on Sat Jul 05, 2008 1:42 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

asdd1 wrote:
nml375 wrote:asdd1: If you're using the piece of code posted by me, it's meant to replace the pv_kick2 in the script posted by speechles.

Regardless which you use, you'll need to set the variable bannedwords to a list of "badwords".
I'm using the speechles variant and it doesnt detect :(.
Regardless which you use, you'll need to set the variable bannedwords to a list of "badwords".
What you mean ?
Hadn't seen your post 'bout "fixed but not detecting" when I replied. But basically, in the top of the script, there is a line saying set bannedwords "# join channel klik www pussy http". This line sets that variable to hold a set of words used to detect spam (badwords).
NML_375
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

asdd1 wrote:
nml375 wrote:
asdd1 wrote:Ok, fixed, but my spam isn't detected ;(
The change to using newchanban requires that you configured your bot to enforce bans on the channel(s) (.chanset #thechannel +enforcebans), and it will not kick or ban people identified as friends (or op if set +dontkickops) or masters/owners. Could you doublecheck these conditionals with your test bench?
<05.07 19:50:47> <gather-lv> [19:50] #janis# chanset #Botnet +enforcebans
<05.07 19:51:01> <gather-lv> [19:51] gather-lv joined #botnet.
<05.07 19:51:01> <gather-lv> [19:51] #botnet: mode change '+o gather-lv' by ChanServ!service@services.irc.lv

No result. I have different IPs.
Oki, could you see if your test client shows up when you do .bans ?
NML_375
a
asdd1
Voice
Posts: 23
Joined: Sat Jul 05, 2008 6:33 am

Post by asdd1 »

asd
Last edited by asdd1 on Sat Jul 05, 2008 1:42 pm, edited 1 time in total.
Post Reply