| View previous topic :: View next topic |
| Author |
Message |
Fahad Op

Joined: 29 Aug 2016 Posts: 127
|
Posted: Sat Mar 25, 2017 6:37 am Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Mar 25, 2017 6:59 am Post subject: |
|
|
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: | # 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
}
}
} |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Mar 25, 2017 1:55 pm Post subject: |
|
|
simo, try make your existing proc check:isreg to look more like this...
| Code: |
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. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Sun Mar 26, 2017 11:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Mar 26, 2017 4:46 am Post subject: |
|
|
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: |
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. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Mar 26, 2017 6:01 am Post subject: |
|
|
| Quote: |
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
"} "
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Mar 26, 2017 6:21 am Post subject: |
|
|
spike i changed it to:
wich seems to have helped of i done correct that is
| Quote: | 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
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Mar 26, 2017 6:34 am Post subject: |
|
|
ceasar changed your code
and got this error:
Tcl error [::RegVoice::isReg]: can't read "verifieduser": no such variable |
|
| Back to top |
|
 |
Fahad Op

Joined: 29 Aug 2016 Posts: 127
|
Posted: Sun Mar 26, 2017 8:59 am Post subject: |
|
|
| and also " identified for this nick " |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Mar 26, 2017 9:13 am Post subject: |
|
|
| Quote: | | 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:
| Quote: | | "has identified for this nick" |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Mar 26, 2017 10:28 pm Post subject: |
|
|
Just some cut and paste slime left over in proc isReg.
Try this cleaned up some more... | Code: |
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. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Sun Mar 26, 2017 11:08 pm; edited 3 times in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Mar 26, 2017 10:31 pm Post subject: |
|
|
simo, | Code: |
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
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Mar 27, 2017 3:28 am Post subject: |
|
|
i tested and got this error:
| Code: | 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"
}
}
}
}
}
|
| Quote: | Tcl error [::RegVoice::public]: can't read "channel": no such variable
|
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Mar 27, 2017 6:30 am Post subject: |
|
|
Ah crap.. Since the public and private message had about the same messages joined them and forgot to change the channel variable. Replace:
| Code: |
proc doAction {mode chan dest} {
if {![validchan $channel] || ![botonchan $channel]} {
|
with:
| Code: |
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. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Mar 27, 2017 6:48 am Post subject: |
|
|
now getting:
| Quote: | | Tcl error [::RegVoice::isReg]: can't read "verifieduser": no such variable |
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Mar 27, 2017 7:20 am Post subject: |
|
|
This is weird since the variable verifieduser should have fixed the problem... Anyway, we got two options:
1. replace this line:
| Code: |
set verifieduser "*has identified for*"
|
with:
| Code: |
variable verifieduser "*has identified for*"
|
and see if helps, if not, then...
2. hard-code the expected line into the code by replacing:
| Code: |
if {![string match $verifieduser $text]} return
|
with:
| Code: |
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. |
|
| Back to top |
|
 |
|