| View previous topic :: View next topic |
| Author |
Message |
Sedition Voice
Joined: 14 Dec 2011 Posts: 16 Location: Bolivia, Beni, Trinidad / DALnet
|
Posted: Wed Dec 17, 2014 10:35 pm Post subject: help please flags |
|
|
this tcl lacks something so that he says (you have no privileges)
the tcl talks each other that denege the order why the common user has no privileges
and the bot makes it know like message in the channel
| Code: | bind pub o|o !control control
bind pub o|o .control control
proc control {nick host hand chan text} {
global flagaccess
if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0}
puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}
|
_________________ good I wait for all that he learns more on tcl thanks for shaping a solid group of help |
|
| Back to top |
|
 |
Sedition Voice
Joined: 14 Dec 2011 Posts: 16 Location: Bolivia, Beni, Trinidad / DALnet
|
Posted: Wed Dec 17, 2014 10:54 pm Post subject: Re: help please flags |
|
|
the correct thing would be
| Code: | #### tcl ####
set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control
proc control {nick host hand chan text} {
global flagaccess
if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
}
puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
} |
_________________ good I wait for all that he learns more on tcl thanks for shaping a solid group of help |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Dec 19, 2014 4:31 am Post subject: |
|
|
You should switch from putquick to puthelp cos if multiple members issue the same command the bot will flood itself off.
What's the point on having the onchan there? Also, instead of using return 0 you could use the if ... else ... like:
| Code: |
if {condition} {
# true
} else {
# false
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Sedition Voice
Joined: 14 Dec 2011 Posts: 16 Location: Bolivia, Beni, Trinidad / DALnet
|
Posted: Sun Jan 25, 2015 2:01 pm Post subject: |
|
|
ok thanks caesar
a question and putserv it is well or not to be used and not to fill of flood
| Code: |
set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control
proc control {nick host hand chan text} {
global flagaccess
if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
}
puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}
|
is correct caesar ? _________________ good I wait for all that he learns more on tcl thanks for shaping a solid group of help |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Jan 26, 2015 8:50 am Post subject: |
|
|
Apart from changing from putquick to puthelp according to my recommendation, I still see the onchan and that you didn't use the if .. else .. syntax.
Anyway, just to be on the safe side I've added user's throttle proc to limit the non registered users from flooding the bot to one command every 5 seconds, or how many you wish.
| Code: |
set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control
proc control {nick uhost hand chan text} {
global flagaccess
if {![matchattr $hand $flagaccess $chan]} {
if {![throttled $chan 5]} {
puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)"
}
} else {
puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}
}
# user's throttled
proc throttled {id seconds} {
global throttle
if {[info exists throttle($id)]&&$throttle($id)>[clock sec]} {
set id 1
} {
set throttle($id) [expr {[clock sec]+$seconds}]
set id 0
}
}
bind time - ?0* throttledCleanup
proc throttledCleanup args {
global throttle
set now [clock sec]
foreach {id time} [array get throttle] {
if {$time<=$now} {unset throttle($id)}
}
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Sedition Voice
Joined: 14 Dec 2011 Posts: 16 Location: Bolivia, Beni, Trinidad / DALnet
|
Posted: Wed Jan 28, 2015 6:13 pm Post subject: |
|
|
very quite thank you.. _________________ good I wait for all that he learns more on tcl thanks for shaping a solid group of help |
|
| Back to top |
|
 |
|