caesar wrote:You lost me at second line. If the DJ gives @ to someone then the bot shouldn't remove the @ from them?
Yes, the bot only gives @ (OP) to the DJ that is going to broadcast (current DJ).
When the DJ completes its broadcast, the robot removes the @ (DEOP).
If somebody gives @ to one DJ who is not brodcasting, then I want the bot removes this @ inmediately.
caesar wrote:Or the bot shouldn't remove the @ if the person who just got it or already had the @ is either the current DJ or has one of the flags you mentioned?
If the person who gets the @ is the current DJ or has one of the flags mentioned above, then the bot does NOT has to take it off.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks
bind mode - "% +o" dj:check:op
proc dj:check:op {nick host hand chan mode vict} {
global canal_radio
if {![string match -nocase $chan $canal_radio]} return
if {![botisop $chan]} return
if {[file exist "dj"]} {
set fo [open "dj" r]
set data [read -nonewline $fo]
set dj [lindex $data 0]
close $fo
}
if {[info exists dj]} {
foreach user [chanlist $chan] {
if {[isbotnick $nick]} continue
if {![isop $user $chan]} continue
if {[string equal -nocase $user $dj]} continue
set hand [nick2hand $user $chan]
if {[dj:check:flags $chan $hand]} continue
lappend uList $user
}
if {[info exists uList]} {
set max 6
set len [llength $uList]
while {$len > 0} {
if {$len > $max} {
set m1 [string repeat "o" $max]
set m2 [string repeat "v" $max]
set users [join [lrange $uList 0 [expr {$max - 1}]]]
set uList [lrange $uList $max end]
incr len -$max
} else {
set m1 [string repeat "o" $len]
set m2 [string repeat "v" $len]
set users [join $uList]
set len 0
}
pushmode $chan -$m1 $users
pushmode $chan +$m2 $users
puthelp "PRIVMSG $chan :$users to be @ with you must be emitting."
}
}
}
}
proc dj:check:flags {chan hand {flags "oatn"}} {
set match 0
if {[validuser $hand]} {
foreach flag [split $flags] {
if {[matchattr $hand $flag $chan]} {
set match 1
break
}
}
}
return "$match"
}
When there's a +o the bot will check the entire list of @ members to see if a member has one of the flags or is DJ, if not will remove @ and give voice (+) instead. Haven't tested this so load it on a test bot.
Edit: Fixed typo.
Last edited by caesar on Fri Sep 23, 2016 9:56 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
10:47 ? => ¦ CHaN puts mode [+o juanam ]
10:47 @My-BoT ¦ CHaN CHaN CHaN CHaN to be @ with you must be emitting.
My BoT mentions 4 times Bot CHaN, when he should do it once to my nick, and then NOT remove @, but anyway it should NOT be because I have all the flags.
I'll test right now to see what else isn't working.
Edit: I did some limited testing in tclsh and seems to be working as intended. Make the change and let me know if still doesn't and will test on a bot.
Once the game is over, the king and the pawn go back in the same box.