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.

help with public command

Old posts that have not been replied to for several years.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

help with public command

Post by detonated »

i've got a problem with this flag issue.

-------------------------------------------------------------------------------------
`Mari|yn yes 0 jmoptx 03:13 (#localband)
#localband mov 03:13
#admirer mov never
-------------------------------------------------------------------------------------

the coding is as follows..

bind pub o|o !act pub:act
proc pub:act {nick host hand chan arg} {
global botnick
if {![auth:check $hand]} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !act <chan> <what>"
return 0
}
set thechan [lindex $arg 0]
set what [lrange $arg 1 end]
if {![onchan $botnick $thechan]} {
notice $nick "I'm not on that channel."
return 0
}
puthelp "PRIVMSG $thechan :\001ACTION\001 $what"
notice $nick "Act to $thechan: $what"
putcmdlog "<<$nick>> !$hand! ($thechan) !act $what"
}
-------------------------------------------------------------------------------------

even me the owner to the bot couldn't trigger this public command. could anione tell me why this coding doesnt work?
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Re: help with public command

Post by Xpert »

detonated wrote:notice $nick "I'm not on that channel."
TCL scripts doesn't support only "notice".
You should insert the "notice" command into "puthelp" command, like this:

Code: Select all

puthelp "NOTICE $nick :MESSAGE"
Your script should be like that:

Code: Select all

bind pub o|o !act pub:act 
proc pub:act {nick host hand chan arg} { 
  global botnick 
  if {![auth:check $hand]} {
    return 0
  } 
  if {[llength $arg] < 2} { 
    notice $nick "Usage: !act <chan> <what>" 
    return 0 
  } 
  set thechan "[lindex $arg 0]"
  set what "[lrange $arg 1 end]"
  if {![onchan $botnick $thechan]} { 
    puthelp "NOTICE $nick :I'm not on that channel." 
    return 0 
  } 
  puthelp "PRIVMSG $thechan :\001ACTION\001 $what" 
  puthelp "NOTICE $nick :Act to $thechan: $what"
  putcmdlog "<<$nick>> !$hand! ($thechan) !act $what" 
}
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

i've just edited the coding n rehashed the bot. and it doesnt seem to have any effect :cry: this stupid bot is even defying the bot-owner!
and the funny thing is, its working for the !banlist.

--------coding as follows for banlist--------

bind pub m|m !banlist pub:banlist
proc pub:banlist {nick host hand chan arg} {
notice $nick "-Global bans-"
if {[banlist] == ""} {
notice $nick "None"
} else {
foreach ig [banlist] {
set what [lindex $ig 0]
set by [lindex $ig 1]
set comment [lindex $ig 4]
notice $nick "$what - $by"
}}
notice $nick "-Bans for $chan-"
if {[banlist $chan] == ""} {
notice $nick "None"
} else {
foreach b [banlist $chan] {
set what [lindex $b 0]
set by [lindex $b 5]
set comment [lindex $b 1]
notice $nick "$what - $by"
}}
}
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

detonated wrote:i've just edited the coding n rehashed the bot. and it doesnt seem to have any effect :cry: this stupid bot is even defying the bot-owner!
Do you have the "auth:check" proc?
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

yeap. the public command work if u have either performed a /dcc chat botnick or by doing a public auth.
-----this is the coding----
# Usage: /msg $botnick auth <password>
proc auth:auth {nick uhost hand arg} {
global botnick
set found 0
foreach n [channels] {
if {[onchan $nick $n]} {
set found 1
}
}
if {$found == 0} {return 0}
if {[llength $arg] <1} {
notice $nick "Usage: /msg $botnick auth <pass>"
return 0
}
set pass [lindex $arg 0]
if {$hand == "*"} {
say $nick "You are not permitted to use my commands."
return 0
}
if {[getuser $hand XTRA AUTH] == "DEAD"} {
say $nick "Sorry, but you have been disabled from using my commands."
return 0
}
if {[passwdok $hand $pass]} {
setuser $hand XTRA "AUTH" "1"
putcmdlog "<<$nick>> ($uhost) !$hand! AUTH ..."
notice $nick "Password accepted."
return 0
} else {
notice $nick "Password denied."
}
}
-------------------------------------------------------------------------------------
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Try this code:

Code: Select all

bind pub o|o !act pub:act 
proc pub:act {nick host hand chan arg} { 
  global botnick 
  if {![auth:check $hand]} {
    puthelp "NOTICE $nick :You aren't authorized." 
    return 0 
  } 
  if {[llength $arg] < 2} { 
    notice $nick "Usage: !act <chan> <what>" 
    return 0 
  } 
  set thechan "[lindex $arg 0]" 
  set what "[lrange $arg 1 end]" 
  if {![onchan $botnick $thechan]} { 
    puthelp "NOTICE $nick :I'm not on that channel." 
    return 0 
  } 
  puthelp "PRIVMSG $thechan :\001ACTION\001 $what" 
  puthelp "NOTICE $nick :Act to $thechan: $what" 
  putcmdlog "<<$nick>> !$hand! ($thechan) !act $what" 
}
And if it send you a notice that your are not authorized, and you are authorized to the bot - then there is problem with the "auth:check" proc.
Check it :)
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

this tcl is totally haywired! even after /msg bot deauth, a notice appears saying the user is now deauth for now, but yet upon typing !command, the bot responded to it. Guess i got to go n look for another tcl. I've tried several, but it always unsuccessful. anyone with really effective public command tcl? anyways, thanks Xpert. :)
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Post here all your commands of the "auth", and i'll try to fix it :)
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

----as follows----
# Usage: /msg $botnick auth <password>
proc auth:auth {nick uhost hand arg} {
global botnick
set found 0
foreach n [channels] {
if {[onchan $nick $n]} {
set found 1
}
}
if {$found == 0} {return 0}
if {[llength $arg] <1} {
notice $nick "Usage: /msg $botnick auth <pass>"
return 0
}
set pass [lindex $arg 0]
if {$hand == "*"} {
say $nick "You are not permitted to use my commands."
return 0
}
if {[getuser $hand XTRA AUTH] == "DEAD"} {
say $nick "Sorry, but you have been disabled from using my commands."
return 0
}
if {[passwdok $hand $pass]} {
setuser $hand XTRA "AUTH" "1"
putcmdlog "<<$nick>> ($uhost) !$hand! AUTH ..."
notice $nick "Password accepted."
return 0
} else {
notice $nick "Password denied."
}
}

proc auth:signcheck {nick uhost hand chan reason} {
if {$hand == "*"} {return 0}
if {[getuser $hand XTRA AUTH] == "DEAD"} {
return 0
}
setuser $hand XTRA "AUTH" "0"
putlog "Auth for $hand expired."
}

proc auth:check {hand} {
set auth [getuser $hand XTRA "AUTH"]
if {($auth == "") || ($auth == "0") || ($auth == "DEAD")} {
return 0
} else { return 1}
}

proc auth:deauth {nick uhost hand arg} {
if {[getuser $hand XTRA AUTH] == "DEAD"} {
say $nick "Sorry, but you have been disabled from using my commands."
return 0
}
if {$hand != "*"} {
setuser $hand XTRA "AUTH" "0"
putcmdlog "<<$nick>> ($uhost) !$hand! DEAUTH"
notice $nick "Authentication has been removed."
}
}
-------------------------------------------------------------------------------------

hey thanks a lot man! :P you're my saviour!
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Where are the binds? :)
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

oops! :roll:

-------------------------------------------------------------------------------------
######binds#########
bind pub n !disable pub:disable
bind pub n !enable pub:enable
bind msg - auth auth:auth
bind sign - * auth:signcheck
bind msg - deauth auth:deauth
-------------------------------------------------------------------------------------
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

This should work:

Code: Select all

bind pub n !disable pub:disable
bind pub n !enable pub:enable
bind msg - auth auth:auth
bind sign - * auth:signcheck
bind msg - deauth auth:deauth
bind pub o|o !act pub:act

proc pub:act {nick host hand chan arg} {
  global botnick
  if {![auth:check $nick]} {
    return 0
  }
  if {[llength $arg] < 2} {
    notice $nick "Usage: !act <chan> <what>"
    return 0
  }
  set thechan "[lindex $arg 1]"
  set what "[lrange $arg 2 end]"
  if {![botonchan $thechan]} {
    puthelp "NOTICE $nick :I'm not on that channel."
    return 0
  }
  puthelp "PRIVMSG $thechan :\001ACTION\001 $what"
  puthelp "NOTICE $nick :Act to $thechan: $what"
  putcmdlog "<<$nick>> !$hand! ($thechan) !act $what"
}


# Usage: /msg $botnick auth <password> 
proc auth:auth {nick uhost hand arg} { 
  global botnick 
  set found 0 
  foreach n [channels] { 
    if {[onchan $nick $n]} { 
      set found 1 
    } 
  } 
  if {$found == 0} {
    return 0
  } 
  if {[llength $arg] < 1} { 
    putserv "notice $nick :Usage: /msg $botnick auth <pass>" 
    return 0 
  } 
  set pass "[lindex $arg 1]"
  if {$hand == "*"} {
    putserv "privmsg $nick :You are not permitted to use my commands."
    return 0
  }
  if {[getuser $nick XTRA AUTH] == "DEAD"} { 
    putserv "privmsg $nick :Sorry, but you have been disabled from using my commands." 
    return 0 
  } 
  if {[passwdok $nick $pass]} { 
    setuser $nick XTRA "AUTH" "1" 
    putcmdlog "<<$nick>> ($uhost) !$hand! AUTH ..." 
    putserv "notice $nick :Password accepted." 
    return 0
    } else { 
    putserv "notice $nick :Password denied." 
  } 
} 

proc auth:signcheck {nick uhost hand chan reason} {
  if {$hand == "*"} {
    return 0
  }
  set auth "[getuser $nick XTRA "AUTH"]"
  if {($auth == "") || ($auth == "0") || ($auth == "DEAD")} { 
    return 0
  }
  setuser $hand XTRA "AUTH" "0"
  putlog "Auth for $nick has been expired."
}

proc auth:check {nick} {
  set auth "[getuser $nick XTRA "AUTH"]"
  if {($auth == "") || ($auth == "0") || ($auth == "DEAD")} { 
    return 0 
    } else { 
    return 1
  } 
} 

proc auth:deauth {nick uhost hand arg} { 
  if {[getuser $nick XTRA AUTH] == "DEAD"} { 
    putserv "privmsg $nick :Sorry, but you have been disabled from using my commands." 
    return 0 
  } 
  if {$hand != "*"} { 
    setuser $nick XTRA "AUTH" "0" 
    putlog "<<$nick>> ($uhost) !$hand! DEAUTH" 
    putserv "notice $nick :Authentication has been removed." 
  } 
} 
Try :)
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

I keep getting the reply "password denied" even though its the correct password. :-?
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Sorry, it's my mistake.
Change:

Code: Select all

if {[passwdok $nick $pass]} {
to:

Code: Select all

if {[passwdok $hand $pass]} {
:)
Xpert.
d
detonated
Voice
Posts: 16
Joined: Sat Mar 13, 2004 3:10 am

Post by detonated »

should i change these too?

Code: Select all

if {[passwdok $nick $pass]} { 
    setuser $nick XTRA "AUTH" "1" 

Code: Select all

if {$hand != "*"} { 
    setuser $nick XTRA "AUTH" "0" 
    putlog "<<$nick>> ($uhost) !$hand! DEAUTH" 
i should change all $nick to $hand right?
i changed only the first $nick n it still produce the same error.
Last edited by detonated on Sat Mar 13, 2004 11:46 am, edited 2 times in total.
Locked