| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Thu Sep 22, 2016 4:40 pm Post subject: OP Event doubt |
|
|
I want to control the OP events, when someone comes up with @ to a my channel ($canal_radio).
If the nick you get @ it is the DJ ($dj) that emits or has flags are +o +a +t or +n not do anything.
If the nick you get @ it is NOT the DJ ($dj) that emits or flags are NOT +o +a +t or +n the bot must remove the @ (DEOP or -o).
To be honest I do not know the on OP event.
I tried this but it did not work :
| Code: | bind mode - "% +o" check:op
proc check:op {nick host hand chan mode target} {
global canal_radio
if {[file exist dj]} {
set temp [open "dj" r]
set dj1 [gets $temp]
set dj [lindex $dj1 0]
close $temp
}
if {([info exist dj]) && ([matchattr $nick -o]) && ([matchattr $nick -a]) && ([matchattr $nick -n]) && ([matchattr $nick -t]) && ($nick != $::botnick)} {
foreach users [chanlist $canal_radio] {
if {[isop $users $canal_radio]} {
if {($users eq $::botnick) || ($users eq $dj) || ([matchattr $users o]) || ([matchattr $users a]) || ([matchattr $users n]) || ([matchattr $users t]) } {continue}
if {$users != $dj} {
putserv "mode $canal_radio +v $dj"
putserv "mode $canal_radio -o $dj"
putserv "PRIVMSG chan :DEOP $canal_radio $dj"
putquick "PRIVMSG $canal_radio :\002$dj\002 to be @ with you must be emitting."
}
}
}
} else { return }
}
|
_________________ 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  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Sep 23, 2016 2:42 am Post subject: |
|
|
You lost me at second line. If the DJ gives @ to someone then the bot shouldn't remove the @ from them?
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? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Fri Sep 23, 2016 3:10 am Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Sep 23, 2016 3:24 am Post subject: |
|
|
Give this a try:
| Code: |
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. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Fri Sep 23, 2016 9:56 am; edited 1 time in total |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Fri Sep 23, 2016 5:21 am Post subject: |
|
|
It does not work
If I try to give me @ through boT CHaN (Official Network Bot, i.e ChanServ)
| Code: | | /msg CHaN OP #mychannel juanam |
| Quote: | 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.
If I give @ Maria (NOT the current DJ)
| Code: | | /mode #mychannel +o Maria |
| Quote: | 10:47 ? => ¦ juanam puts mode [+o Maria ]
10:47 @My-BoT ¦ juanam juanam juanam juanam juanam to be @ with you must be emitting. |
My BoT mentions 5 times my nick instead of Maria and then NOT remove @. _________________ 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  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Sep 23, 2016 7:31 am Post subject: |
|
|
Ah i noticed a typo. Replace:
| Code: |
lappend uList $nick
|
with
| Code: |
lappend uList $user
|
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. |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Fri Sep 23, 2016 3:14 pm Post subject: |
|
|
Now, work perfectly. Thank you caesar.
I had to change this:
| Code: | pushmode $chan -$m1 $users
pushmode $chan +$m2 $users |
for this:
| Code: | putserv "mode $canal_radio +v $users"
putserv "mode $canal_radio -o $users" |
This may be because the commands are different in my Network. _________________ 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  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Sep 24, 2016 2:15 am Post subject: |
|
|
My guess it has to do with having just a single mode change if it applies to multiple victims. To test this out from your irc client do:
| Code: |
/mode #channel +v member_1 member_2 member_3 member_4 member_5 member_6
|
and if you voice all 6 members in one line then replace your putserv lines with:
| Code: |
pushmode $chan -o $users
pushmode $chan +v $users
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat Sep 24, 2016 7:15 pm Post subject: |
|
|
Ok, I'll try, but it works perfect. _________________ 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  |
|
| Back to top |
|
 |
|