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.

Auto Voice To Those Who Are Register NICK.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
Fahad
Op
Posts: 129
Joined: Mon Aug 29, 2016 9:40 am

Post by Fahad »

simo wrote:tnx caesar as well

the amount of time and work is always apreciated and valued

oh and i saw u sugested few changes caesar can u perhaps pastebin the final code since its kinda confusing where to change exactly

i tried to aply the changes but got confused with the valid channel check where to insert that exactly
Yeah That's What I said. I also Need Final Code :)
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

so far this is what i ended up with:


i only changed the :

foreach chan [channels] { ****



anything else i changed as u sugested gave me bunch of errors so ive must have done wrong

Code: Select all

# SYNTAX (on PartyLine/DCC/CTCP/TELnet): .chanset #channel -/+checkisauth
# ----------
# PUBCMD:
# !checkisreg on|off
# ----------
# MSGCMD:
# /msg botnick checkisreg #channel on|off

# ---------- SETTINGS ----------
# Set your global trigger (default: !)
set checkisregtrig "!"

# Set global|channel access flags to enable/disable authcheck (default: o|o)
set regsetflags n|n

# Set here the string used to match registered/authenticated user's
set verifieduser "*is a registered nick*"

# ----- NO EDIT -----
# You may have to change the RAW numeric below to match your IRCd.
bind raw - 307 check:isreg
bind join - * join:checkisreg
bind pub - ${checkisregtrig}checkisreg authcheck:pub
bind pub - !checkisreg authcheck:pub
bind msg - checkisreg authcheck:msg

proc isregTrigger {} {
  global checkisregtrig
  return $checkisregtrig
}

setudef flag checkisauth

proc join:checkisreg {nick uhost hand chan} {
  if {![channel get $chan checkisauth]} {return}
  if {![isbotnick $nick] && ![validuser [nick2hand $nick]]} {
    putserv "WHOIS $nick"
  }
}

proc check:isreg {from keyword args} {
  global verifieduser
  if {![string match $verifieduser $args]} {return}
  set nick [lindex [split $args] 1]
foreach chan [channels] {
     if {![onchan $nick $chan] || ![channel get $chan checkisauth] || [validuser [nick2hand $nick]] || [isop $nick $chan] || [isvoice $nick $chan]} {continue}
     putquick "MODE $chan +v $nick"
   } 
}

proc authcheck:pub {nick uhost hand chan arg} {
  global regsetflags
  if {[matchattr [nick2hand $nick] $regsetflags $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [isregTrigger]checkisreg on|off"; return}

    if {[lindex [split $arg] 0] == "on"} {
      if {[channel get $chan checkisauth]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +checkisauth
      puthelp "NOTICE $nick :Enabled Automatic Register Checking for $chan"
      return 0
    }

    if {[lindex [split $arg] 0] == "off"} {
      if {![channel get $chan checkisauth]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -checkisauth
      puthelp "NOTICE $nick :Disabled Automatic Register Checking for $chan"
      return 0
    }
  }
}

proc authcheck:msg {nick uhost hand arg} {
  global botnick regsetflags
  set chan [strlwr [lindex [split $arg] 0]]
  if {[matchattr [nick2hand $nick] $regsetflags $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick checkisreg #channel on|off"; return}
    if {([lindex [split $arg] 1] == "") && ([string match "*#*" $arg])} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick checkisreg $chan on|off"; return}

    if {[lindex [split $arg] 1] == "on"} {
      if {[channel get $chan checkisauth]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +checkisauth
      putquick "NOTICE $nick :Enabled Automatic Register Checking for $chan"
      return 0
    }

    if {[lindex [split $arg] 1] == "off"} {
      if {![channel get $chan checkisauth]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -checkisauth
      putquick "NOTICE $nick :Disabled Automatic Register Checking for $chan"
      return 0
    }
  }
} 
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

simo, try make your existing proc check:isreg to look more like this...

Code: Select all

proc check:isreg {from keyword args} { 
  global verifieduser 
  if {![string match $verifieduser $args]} {return} 
  set nick [lindex [split $args] 1] 

  if {[validuser [nick2hand $nick]]} return
  foreach chan [channels] {
    if {![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} continue 
    pushmode $chan +v $nick 
  }
 
} 


EDIT: Fixed this proc for missing open brace.
Last edited by SpiKe^^ on Sun Mar 26, 2017 11:27 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Haven't tested it so might have a bug, two or none at all, so test it out and drop a reply with the outcome. :)

You might want to remove old code and restart the bot so the new code kicks in.

Added a rudimentary self cleaning check that would make the bot whois someone only once when joining one of the channels where checkisauth is enabled.

Code: Select all

namespace eval RegVoice {
	set verifieduser "*has identified for*" 
	setudef flag checkisauth 

	bind join - * [namespace current]::joinCheck
	bind raw - 307 [namespace current]::isReg
	bind pub o|o !checkisreg [namespace current]::public
	bind msg o|o checkisreg [namespace current]::message
	
	bind time - * [namespace current]::cleanUp

	proc cleanUp {minute hour day month year} {
		global checkAuth
		if {[info exists checkAuth]} {
			foreach nick $checkAuth {
				if {![onchan $nick]} {
					set pos [lsearch -nocase $nick $checkAuth]
					set checkAuth [lreplace $checkAuth $pos $pos]
				}
			}
		}
	}
	
	proc joinCheck {nick uhost hand chan} {
		global checkAuth
		if {[isbotnick $nick]} return
		if {![channel get $chan checkisauth] || [validuser $hand]} return
		if {[info exists checkAuth]} {
			if {[lsearch -nocase $nick $checkAuth] != -1} return
		}
		lappend checkAuth $nick
		puthelp "WHOIS $nick"
	}

	proc isReg {from keyword text} {
		global checkAuth verifieduser
		set nick [lindex [split $text] 1]
		if {[info exists checkAuth]} {
			set pos [lsearch -nocase $nick $checkAuth]
			if {$pos != -1} {
				set checkAuth [lreplace $checkAuth $pos $pos]
			}
		}
		if {![string match $verifieduser $text]} return
		if ([validuser [nick2hand $nick]]) return
		foreach chan [channels] {
		   if (![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} continue
		   if {![botisop $chan]} continue
		   pushmode $chan +v $nick
		}
	}
	
	proc public {nick uhost hand chan text} {
	   if {[scan $text {%s} mode] != 1} {
		  puthelp "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: !checkisreg on|off"
		  return
	   }
		doAction $mode $chan $chan
	}

	proc message {nick uhost hand chan text} {
		if {[scan $text {%s%s} mode channel] != 2} {
			puthelp "PRIVMSG $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: checkisreg #channel on|off"
			return
		}
		if {[string first # $channel] != 0} {
			puthelp "PRIVMSG $nick :\037ERROR\037: Provided channel doesn't seem to correct. \037SYNTAX\037: checkisreg #channel on|off"
			return
		}
		doAction $mode $channel $nick
	}

	proc doAction {mode chan dest} {
		if {![validchan $channel] || ![botonchan $channel]} {
			puthelp "PRIVMSG $dest ::\037ERROR\037: Channel $chan doesn't exist in my database or I'm not on it."
			return
		}
		set status [channel get $chan checkisauth]
		switch -- [string tolower $mode] {
			"on" {
				if {$status} {
					puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already enabled."
				} else {
					channel set $chan +checkisauth
					puthelp "PRIVMSG $dest :Enabled Automatic Register Checking for $chan"
				}
			}
			"off" {
				if {!$status} {
					puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already disabled."
				} else {
					channel set $chan -checkisauth
					puthelp "PRIVMSG $dest :Disabled Automatic Register Checking for $chan"
				}
			}
			default {
				if {![string first # $dest]} {
					puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: !checkisreg on|off"
				} else {
					puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: checkisreg #channel on|off"
				}
			}
		}
	}
}
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »


caesar gettin this error:

Tcl error in file 'bot.conf': invalid command name "}"
while executing
"} "




and spike also gettin error:


Tcl error in file 'bot.conf':
invalid command name "}"
while executing
"} "
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

spike i changed it to:

wich seems to have helped of i done correct that is

proc check:isreg {from keyword args} {
global verifieduser
if {![string match $verifieduser $args]} {return}
set nick [lindex [split $args] 1]
if ([validuser [nick2hand $nick]]) return
foreach chan [channels] {
if {![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} {continue}
pushmode $chan +v $nick
}
}
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

ceasar changed your code
and got this error:


Tcl error [::RegVoice::isReg]: can't read "verifieduser": no such variable
User avatar
Fahad
Op
Posts: 129
Joined: Mon Aug 29, 2016 9:40 am

Post by Fahad »

and also " identified for this nick "
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

and also " identified for this nick "
yes because i tested with anope 2 services wich has that as output
for dalnet u can change that to:
"has identified for this nick"
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Just some cut and paste slime left over in proc isReg.
Try this cleaned up some more...

Code: Select all

 namespace eval RegVoice { 
    set verifieduser "*has identified for*" 
    setudef flag checkisauth 

    bind join - * [namespace current]::joinCheck 
    bind raw - 307 [namespace current]::isReg 
    bind pub o|o !checkisreg [namespace current]::public 
    bind msg o|o checkisreg [namespace current]::message 
     
    bind time - * [namespace current]::cleanUp 

    proc cleanUp {minute hour day month year} { 
       global checkAuth 
       if {[info exists checkAuth]} { 
          foreach nick $checkAuth { 
             if {![onchan $nick]} { 
                set pos [lsearch -nocase $nick $checkAuth] 
                set checkAuth [lreplace $checkAuth $pos $pos] 
             } 
          } 
       } 
    } 
     
    proc joinCheck {nick uhost hand chan} { 
       global checkAuth 
       if {[isbotnick $nick]} return 
       if {![channel get $chan checkisauth] || [validuser $hand]} return 
       if {[info exists checkAuth]} { 
          if {[lsearch -nocase $nick $checkAuth] != -1} return 
       } 
       lappend checkAuth $nick 
       puthelp "WHOIS $nick" 
    } 

    proc isReg {from keyword text} { 
       global checkAuth
       variable verifieduser 

       set nick [lindex [split $text] 1] 
       if {[info exists checkAuth]} { 
          set pos [lsearch -nocase $nick $checkAuth] 
          if {$pos != -1} { 
             set checkAuth [lreplace $checkAuth $pos $pos] 
          } 
       } 
       if {![string match $verifieduser $text]} return 
       if {[validuser [nick2hand $nick]]} return 
       foreach chan [channels] { 
          if {![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} continue 
          if {![botisop $chan]} continue 
          pushmode $chan +v $nick 
       } 
    } 
     
    proc public {nick uhost hand chan text} { 
       if {[scan $text {%s} mode] != 1} { 
         puthelp "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: !checkisreg on|off" 
         return 
       } 
       doAction $mode $chan $chan 
    } 

    proc message {nick uhost hand chan text} { 
       if {[scan $text {%s%s} mode channel] != 2} { 
          puthelp "PRIVMSG $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: checkisreg #channel on|off" 
          return 
       } 
       if {[string first # $channel] != 0} { 
          puthelp "PRIVMSG $nick :\037ERROR\037: Provided channel doesn't seem to correct. \037SYNTAX\037: checkisreg #channel on|off" 
          return 
       } 
       doAction $mode $channel $nick 
    } 

    proc doAction {mode chan dest} { 
       if {![validchan $channel] || ![botonchan $channel]} { 
          puthelp "PRIVMSG $dest ::\037ERROR\037: Channel $chan doesn't exist in my database or I'm not on it." 
          return 
       } 
       set status [channel get $chan checkisauth] 
       switch -- [string tolower $mode] { 
          "on" { 
             if {$status} { 
                puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already enabled." 
             } else { 
                channel set $chan +checkisauth 
                puthelp "PRIVMSG $dest :Enabled Automatic Register Checking for $chan" 
             } 
          } 
          "off" { 
             if {!$status} { 
                puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already disabled." 
             } else { 
                channel set $chan -checkisauth 
                puthelp "PRIVMSG $dest :Disabled Automatic Register Checking for $chan" 
             } 
          } 
          default { 
             if {![string first # $dest]} { 
                puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: !checkisreg on|off" 
             } else { 
                puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: checkisreg #channel on|off" 
             } 
          } 
       } 
    } 
 } 

EDIT: Also fixed a small global/variable issue in proc isReg.
Last edited by SpiKe^^ on Sun Mar 26, 2017 11:08 pm, edited 3 times in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

simo,

Code: Select all

 proc check:isreg {from keyword args} { 
   global verifieduser 
   if {![string match $verifieduser $args]} {return} 
   set nick [lindex [split $args] 1] 

   if {[validuser [nick2hand $nick]]} return 
   foreach chan [channels] { 
     if {![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} continue 
     pushmode $chan +v $nick 
   } 
   
 } 

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested and got this error:

Code: Select all

 namespace eval RegVoice {
    set verifieduser "*has identified for*"
    setudef flag checkisauth

    bind join - * [namespace current]::joinCheck
    bind raw - 307 [namespace current]::isReg
    bind pub o|o !checkisreg [namespace current]::public
    bind msg o|o checkisreg [namespace current]::message
     
    bind time - * [namespace current]::cleanUp

    proc cleanUp {minute hour day month year} {
       global checkAuth
       if {[info exists checkAuth]} {
          foreach nick $checkAuth {
             if {![onchan $nick]} {
                set pos [lsearch -nocase $nick $checkAuth]
                set checkAuth [lreplace $checkAuth $pos $pos]
             }
          }
       }
    }
     
    proc joinCheck {nick uhost hand chan} {
       global checkAuth
       if {[isbotnick $nick]} return
       if {![channel get $chan checkisauth] || [validuser $hand]} return
       if {[info exists checkAuth]} {
          if {[lsearch -nocase $nick $checkAuth] != -1} return
       }
       lappend checkAuth $nick
       puthelp "WHOIS $nick"
    }

    proc isReg {from keyword text} {
       global checkAuth
       variable verifieduser

       set nick [lindex [split $text] 1]
       if {[info exists checkAuth]} {
          set pos [lsearch -nocase $nick $checkAuth]
          if {$pos != -1} {
             set checkAuth [lreplace $checkAuth $pos $pos]
          }
       }
       if {![string match $verifieduser $text]} return
       if {[validuser [nick2hand $nick]]} return
       foreach chan [channels] {
          if {![channel get $chan checkisauth] || ![onchan $nick $chan] || [isop $nick $chan] || [isvoice $nick $chan]} continue
          if {![botisop $chan]} continue
          pushmode $chan +v $nick
       }
    }
     
    proc public {nick uhost hand chan text} {
       if {[scan $text {%s} mode] != 1} {
         puthelp "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: !checkisreg on|off"
         return
       }
       doAction $mode $chan $chan
    }

    proc message {nick uhost hand chan text} {
       if {[scan $text {%s%s} mode channel] != 2} {
          puthelp "PRIVMSG $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: checkisreg #channel on|off"
          return
       }
       if {[string first # $channel] != 0} {
          puthelp "PRIVMSG $nick :\037ERROR\037: Provided channel doesn't seem to correct. \037SYNTAX\037: checkisreg #channel on|off"
          return
       }
       doAction $mode $channel $nick
    }

    proc doAction {mode chan dest} {
       if {![validchan $channel] || ![botonchan $channel]} {
          puthelp "PRIVMSG $dest ::\037ERROR\037: Channel $chan doesn't exist in my database or I'm not on it."
          return
       }
       set status [channel get $chan checkisauth]
       switch -- [string tolower $mode] {
          "on" {
             if {$status} {
                puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already enabled."
             } else {
                channel set $chan +checkisauth
                puthelp "PRIVMSG $dest :Enabled Automatic Register Checking for $chan"
             }
          }
          "off" {
             if {!$status} {
                puthelp "PRIVMSG $dest :\037ERROR\037: This setting is already disabled."
             } else {
                channel set $chan -checkisauth
                puthelp "PRIVMSG $dest :Disabled Automatic Register Checking for $chan"
             }
          }
          default {
             if {![string first # $dest]} {
                puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: !checkisreg on|off"
             } else {
                puthelp "PRIVMSG $dest :\037ERROR\037: $mode is not an accepted parameter. \037SYNTAX\037: checkisreg #channel on|off"
             }
          }
       }
    }
 }

Tcl error [::RegVoice::public]: can't read "channel": no such variable
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ah crap.. Since the public and private message had about the same messages joined them and forgot to change the channel variable. Replace:

Code: Select all

proc doAction {mode chan dest} {
if {![validchan $channel] || ![botonchan $channel]} {
with:

Code: Select all

proc doAction {mode chan dest} {
if {![validchan $chan] || ![botonchan $chan]} {
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

now getting:
Tcl error [::RegVoice::isReg]: can't read "verifieduser": no such variable
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

This is weird since the variable verifieduser should have fixed the problem... Anyway, we got two options:

1. replace this line:

Code: Select all

set verifieduser "*has identified for*"
with:

Code: Select all

variable verifieduser "*has identified for*"
and see if helps, if not, then...

2. hard-code the expected line into the code by replacing:

Code: Select all

if {![string match $verifieduser $text]} return
with:

Code: Select all

if {![string match "*has identified for*" $text]} return
and also drop the variable verifieduser line.
Once the game is over, the king and the pawn go back in the same box.
Post Reply