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 

Solbu's Slowvoice
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Fri Jul 09, 2021 4:03 pm    Post subject: Solbu's Slowvoice Reply with quote

Hi Smile

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:
# 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 Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1138

PostPosted: Fri Jul 09, 2021 6:37 pm    Post subject: Re: Solbu's Slowvoice Reply with quote

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 !
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat Jul 10, 2021 4:49 am    Post subject: Reply with quote

Code:

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
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Sat Jul 10, 2021 2:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 7:25 am    Post subject: Reply with quote

Hi SmileI

Thanks for your replies Smile

The bot have up. (@)

I get this error in the console:

Code:
[13:13:52] <Anne> [13:13:53] Tcl error [sv:nick]: invalid command name "sv:nick"
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1138

PostPosted: Sat Jul 10, 2021 8:07 am    Post subject: Reply with quote

taxick wrote:


...
I get this error in the console:

Code:
[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:

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


Change it to:
Code:

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. Wink
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 8:18 am    Post subject: Reply with quote

Hi Smile

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:
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
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat Jul 10, 2021 10:04 am    Post subject: Reply with quote

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

putlog "Will voice $nick in $chan channel in $delay seconds"

before or after:
Code:

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


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 11:50 am    Post subject: Reply with quote

Hi,

Thanks for the reply..

My script look like this now:

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

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


Joined: 22 Mar 2015
Posts: 653

PostPosted: Sat Jul 10, 2021 1:25 pm    Post subject: Reply with quote

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

on what network / IRCD are you using this ?
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 859
Location: France

PostPosted: Sat Jul 10, 2021 1:30 pm    Post subject: Reply with quote

I'm not sure of:
Code:
set pos [lsearch -nocase [dict keys [join $sv(chan)]] $chan]


You'd better use:
Code:
set pos [lsearch -nocase [split $sv(chan)] $chan]

_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 1:59 pm    Post subject: Reply with quote

Hi..

This edit fixed my problem Smile

Thanks a lot to all the user that help me out here Smile Wink
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat Jul 10, 2021 2:11 pm    Post subject: Reply with quote

Was working on another piece of code with arrays and got carried away. Rolling Eyes Well that should fix everything.
_________________
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
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 2:35 pm    Post subject: Reply with quote

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


Hi Smile

If you have made a new version, I will be happy to check it out Smile
Back to top
View user's profile Send private message
taxick
Voice


Joined: 12 Jul 2007
Posts: 21

PostPosted: Sat Jul 10, 2021 4:57 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Jul 12, 2021 5:41 am    Post subject: Reply with quote

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

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.
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 -> Scripting Help 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