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.

Solbu's Slowvoice

Help for those learning Tcl or writing their own scripts.
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Solbu's Slowvoice

Post by taxick »

Hi :)

I have found a script called "Solbu's Slowvoice v1.1"

I have added it to my config, and change tlc file, so it fits my requirements

But the users don't get voice after 60 ~ 120 sec - Nothing happen

Can someone help me out.. or maybe find another script that can do the same?

I need a script that can auto voice after some time

I use eggdrop 1.9.1

Code: Select all

# slowvoice.tcl v1.1 by Solbu.
# Repository: https://github.com/solbu/eggdrop-scripts
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
#
# After the recent join spam tactic on FreeNode and EFnet in the fall of 2018,
# I needed something that voiced all users joining a moderated channel,
# but it needed to randomly delay the voicing to between 60 and 99 seconds after they join.
# And this is the result after looking on the internet for ideas.
#
# The Spambots this script is made to protect against deliver their spam withing 60 seconds after join.
# Since I deployed this script on the moderated channels I maintain, the spam is gone.
# The spambots stil join, but they can't deliver their cargo since the channels are moderated
# and they don't have voice within the timeframe they deliver their cargo.
#
# The script has been tested on eggdrop v1.8.3. So it should work fine on this version of eggdrop and
# higher. If you find any bug on this script, you can open a bug repport on Github https://github.com/solbu/eggdrop-scripts

## Features:
# This script will voice any user who joins a channel specified after a preset minimum and maximum time.
# Default is to randomly delay voice to between 60 and 99 seconds.

### Options:
## Delay in seconds before we voice someone:
# x:y random delay; minimum x sec, maximum y sec
set sv(delay) 60:120

## Which channel do you want this script to voice people on?
## If you have more than one channel please leave 
## a space between the channels.(e.g "#channel1 #channel2")
set avchan "#futurenode #help"

### Begin Script:
bind join - * join:sv
proc join:sv {nick host hand chan} { global sv
   utimer [expr [lindex [split $sv(delay) :] 0] + [rand [lindex [split $sv(delay) :] 1]]] [list sv:voice $nick $host $hand $chan]
}
bind nick - * nick:sv
proc nick:sv {nick host hand chan newnick} { global sv
   utimer [expr [lindex [split $sv(delay) :] 0] + [rand [lindex [split $sv(delay) :] 1]]] [list sv:voice $newnick $host $hand $chan]
}
proc sv:voice {nick host hand chan} {
   global avchan botnick
 if {$nick == $botnick} {return 0}
 if { [isvoice $nick $chan] == 1 } { return 0 }
 if {$avchan == "" && [botisop $chan]} {
  pushmode $chan +v $nick
  return 0
 }
 set chan [string tolower $chan]
 foreach i [string tolower $avchan] {
  if {$i == $chan && [botisop $chan]} {
   pushmode $chan +v $nick
   return 0
  }
 }
}

foreach c "[channels]" { channel set "$c" -autovoice }
catch { unset $c }

putlog "slowvoice.tcl v1.1 (GPLv3+) by Solbu - Loaded"


Regards

Thomas :)
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: Solbu's Slowvoice

Post by willyw »

taxick wrote: ...
- Nothing happen
...

Be sure to be logged into the partyline, so you can watch to see if there is anything showing up there when a nick joins. Let us know what you see.

You may want to experiment with your console flags, so you can see more.
Do:
.help console
to get a listing of them, and descriptions.

You might want to try the +v console flag, so you can see what the bot is sending, if anything at all. Let us know what you see.


Do you have the use of the .tcl partyline command enabled for your (owner's) use? If not, you can do that in eggdrop.conf .
Experiment with using:
.tcl utimers
at the right time, to list any utimers. One should exist, right after a join.

And - is bot op'd ?
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set sv(delay) 60:120
set sv(chan) "#chan1 #chan2"

bind join - * sv:join
bind nick - * sv:nick

proc sv:join {nick uhost hand chan} {
	sv:delay $nick $uhost $hand $chan
}

proc sv:nick {nick uhost hand chan newnick} {
	sv:delay $nick $uhost $hand $chan $newnick
}

proc sv:delay {nick uhost hand chan {newnick ""}} {
	global sv
	set chan [string tolower $chan]
	if {[isbotnick $nick] || ![botisop $chan]} return
	scan [split $sv(delay) :] {%d%d} min max
	set delay [expr {int(rand() * ($max + 1 - $min)) + $min}]
	if {[llength $newnick]} {
		set nick $newnick
	}
	utimer $delay [list sv:voice $nick $chan]
}

proc sv:voice {nick chan} {
	global sv
	if {![botisop $chan] || [isvoice $nick $chan]} return
	if {![llength $sv(chan)]} {
		pushmode $chan +v $nick
	} else {
		set pos [lsearch -nocase [split $sv(chan)] $chan]
		if {$pos > -1} {
			pushmode $chan +v $nick
		}
	}
}

foreach chan [channels] {
	if {[channel get $chan autovoice]} {
		channel set $chan -autovoice
	}
}
Try this out. Haven't tested it.

Edit: Fixed all errors, this is the working code.. or at least should. xD
Last edited by caesar on Sat Jul 10, 2021 2:10 pm, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

Hi :)I

Thanks for your replies :)

The bot have up. (@)

I get this error in the console:

Code: Select all

[13:13:52] <Anne> [13:13:53] Tcl error [sv:nick]: invalid command name "sv:nick"
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

taxick wrote:
...
I get this error in the console:

Code: Select all

[13:13:52] <Anne> [13:13:53] Tcl error [sv:nick]: invalid command name "sv:nick"
You didn't specify which script that error is from, but I believe it is from caesar's above.

Find:

Code: Select all

proc nick:sv {nick uhost hand chan newnick} {
   sv:delay $nick $uhost $hand $chan $newnick
} 
Change it to:

Code: Select all

proc sv:nick {nick uhost hand chan newnick} {
   sv:delay $nick $uhost $hand $chan $newnick
} 
It's the kind of thing that we have all done, a hundred times. ;)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

Hi :)

Thanks for the reply.

The last code from @willyw fixed my error in the console

But the eggdrop still don't give voice after some time

No errors in the console

EDIT

So far my script look like this

Code: Select all

set sv(delay) 30:60
set sv(chan) "#futurenode #help"

bind join - * sv:join
bind nick - * sv:nick

proc sv:join {nick uhost hand chan} {
   sv:delay $nick $uhost $hand $chan
}

proc sv:nick {nick uhost hand chan newnick} {
   sv:delay $nick $uhost $hand $chan $newnick
}

proc sv:delay {nick uhost hand chan {newnick ""}} {
   global sv
   set chan [string tolower $chan]
   if {[isbotnick $nick] || ![botisop $chan]} return
   scan [split $sv(delay) :] {%d%d} min max
   set delay [expr {int(rand() * ($max + 1 - $min)) + $min}]
   if {[llength $newnick]} {
      set nick $newnick
   }
   utimer $delay [list sv:voice $nick $chan]
}

proc sv:voice {nick chan} {
   global sv
   if {![botisop $chan] || [isvoice $nick $chan]} return
   if {![llength $sv(chan)]} {
      pushmode $chan +v $nick
   } else {
      set pos [lsearch -nocase [dict keys [join $sv(chan)]] $chan]
      if {$pos > -1} {
         pushmode $chan +v $nick
      }
   }
}

foreach chan [channels] {
   if {[channel get $chan autovoice]} {
      channel set $chan -autovoice
   }
}
I have to you set

.console #help +c
.console #futurenode +c
.chanset #help +autovoice
.chanset #futurenode +autovoice


// Thomas
Last edited by taxick on Sat Jul 10, 2021 11:28 am, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ah, right. I made some changes in the proc names and forgot to adjust. Anyway, to debug this thing just add:

Code: Select all

putlog "Will voice $nick in $chan channel in $delay seconds"
before or after:

Code: Select all

utimer $delay [list sv:voice $nick $chan] 
and see if that happens after said seconds.
Once the game is over, the king and the pawn go back in the same box.
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

Hi,

Thanks for the reply..

My script look like this now:

Code: Select all

set sv(delay) 10:15
set sv(chan) "#futurenode #help"

bind join - * sv:join
bind nick - * sv:nick

proc sv:join {nick uhost hand chan} {
   sv:delay $nick $uhost $hand $chan
}

proc sv:nick {nick uhost hand chan newnick} {
   sv:delay $nick $uhost $hand $chan $newnick
}

proc sv:delay {nick uhost hand chan {newnick ""}} {
   global sv
   set chan [string tolower $chan]
   if {[isbotnick $nick] || ![botisop $chan]} return
   scan [split $sv(delay) :] {%d%d} min max
   set delay [expr {int(rand() * ($max + 1 - $min)) + $min}]
   if {[llength $newnick]} {
      set nick $newnick
   }
   utimer $delay [list sv:voice $nick $chan]
   putlog "Will voice $nick in $chan channel in $delay seconds"
}

proc sv:voice {nick chan} {
   global sv
   if {![botisop $chan] || [isvoice $nick $chan]} return
   if {![llength $sv(chan)]} {
      pushmode $chan +v $nick
   } else {
      set pos [lsearch -nocase [dict keys [join $sv(chan)]] $chan]
      if {$pos > -1} {
         pushmode $chan +v $nick
      }
   }
}

foreach chan [channels] {
   if {[channel get $chan autovoice]} {
      channel set $chan -autovoice
   }
} 
LOG

Code: Select all

[17:48:31] sockread EAGAIN: 8 11 (Resource temporarily unavailable)
[17:48:31] net: connect! sock 8
[17:48:31] Connected to irc.futurenode.dk
[17:48:31] -NOTICE- *** Looking up your hostname...
[17:48:35] -NOTICE- *** Could not resolve your hostname: Request timed out; using your IP address (194.233.162.198) instead.
[17:48:35] triggering bind evnt:init_server
[17:48:35] triggered bind evnt:init_server, user 0.049ms sys 0.049ms
[17:48:35] -NOTICE- *** You are connected to irc.futurenode.dk using TLS (SSL) cipher 'TLS1.3-ECDHE-RSA-AES-256-GCM-AEAD' and your TLS (SSL) client certificate fingerprint is 0c889fdae2bbb9a8d7aaf823935d417aaf837f5fefb6412d0fe26a362ea826c1
[17:48:35] -NickServ (NickServ@futurenode.dk)- This nickname is registered. Please choose a different nickname, or identify via /msg NickServ identify <password>.
[17:48:36] -NickServ (NickServ@futurenode.dk)- You are now identified for Anne.
[17:48:36] SASL: You are now logged in as Anne
[17:48:40] triggering bind sv:join
[17:48:40] triggered bind sv:join, user 0.060ms sys 0.060ms
[17:48:40] Anne joined #futurenode.
[17:48:40] #futurenode: mode change '+o :Anne' by Future-Bot!bot@futurenode.dk
[17:48:48] triggering bind sv:join
[17:48:48] triggered bind sv:join, user 0.024ms sys 0.000ms
[17:48:48] Anne joined #help.
[17:48:48] #help: mode change '+o :Anne' by Future-Bot!bot@futurenode.dk
[17:49:04] triggering bind sv:join
[17:49:04] Will voice Web-Client in #help channel in 12 seconds
[17:49:04] triggered bind sv:join, user 0.067ms sys 0.000ms
[17:49:04] Web-Client (05ba3630@future-3oq.2p0.rovm06.IP) joined #help.
[17:50:00] @#futurenode (+tn) : [m/6 o/2 h/1 v/0 n/3 b/0 e/- I/-]
[17:50:00] @#help (+tn) : [m/6 o/2 h/0 v/0 n/4 b/0 e/- I/-]

I have also try to set thise

.console #help +c
.console #futurenode +c
.chanset #help +autovoice
.chanset #futurenode +autovoice

It says it will give voice in an amount of time. But nothing happens.. Can the problem be the user will have to register to nickserv?
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

ive tested the exact same code and it works fine on my end tho

on what network / IRCD are you using this ?
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I'm not sure of:

Code: Select all

set pos [lsearch -nocase [dict keys [join $sv(chan)]] $chan]
You'd better use:

Code: Select all

set pos [lsearch -nocase [split $sv(chan)] $chan]
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

Hi..

This edit fixed my problem :)

Thanks a lot to all the user that help me out here :) :wink:
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Was working on another piece of code with arrays and got carried away. :roll: Well that should fix everything.
Once the game is over, the king and the pawn go back in the same box.
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

caesar wrote:Was working on another piece of code with arrays and got carried away. :roll: Well that should fix everything.
Hi :)

If you have made a new version, I will be happy to check it out :)
t
taxick
Voice
Posts: 24
Joined: Thu Jul 12, 2007 11:44 am

Post by taxick »

Hi again

Thanks for the help so far

I have a little wish..

Are it possible to give users that have registered / log in to NickServ instant voice

People that don't have a account will need to wait 60:120 sec
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

No, i meant I was working on something else where had implemented something similar and did a copy/paste without actually thinking. :roll:

Anyway, how do you check if someone has his nickname registered/logged in with NickServ?
Once the game is over, the king and the pawn go back in the same box.
Post Reply