View previous topic :: View next topic |
Author |
Message |
Valentin Voice
Joined: 04 Sep 2022 Posts: 14 Location: London
|
Posted: Tue Feb 07, 2023 10:39 pm Post subject: is it posiable someone help me with SAMODE? |
|
|
I`m use this script fot ircop bot to get @ in every chan. Is it posiable to make it to get + in #opers. In every chan will get @, exempt #opers. In #opers has to be with +
Code: |
bind join - * join:opbot
proc join:opbot { nick host hand chan } {
if {$nick eq $::botnick} {
putserv "SAMODE $chan +o $::botnick"
}
}
|
_________________ if there's a will, there's a way. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Wed Feb 08, 2023 2:25 am Post subject: |
|
|
Code: |
bind join - * join:opbot
proc join:opbot { nick host hand chan } {
if {![isbotnick $nick]} return
set mode [expr {[string equal -nocase $chan "#opers"] ? "+o" : "++"}]
putserv "SAMODE $chan $mode $::botnick"
}
|
Replace the second '+' in '++' with whatever mode gives the bot the + flag cos honestly I don't know. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1145 Location: France
|
Posted: Wed Feb 08, 2023 5:50 am Post subject: |
|
|
The "+" is a voice, so +v.
And you like complex code ?
Code: | bind join - * join:opbot
proc join:opbot { nick host hand chan } {
if {![isbotnick $nick]} return
set mode "+o"
if {[string tolower $chan] eq "#opers"} { set mode "+v" }
putserv "SAMODE $chan $mode $::botnick"
} |
_________________ Eggdrop community - French IRC network |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Thu Feb 09, 2023 5:33 am Post subject: |
|
|
You scared of the expr line?
It's basically if condition do this else do something else just wrapped up nicely. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1145 Location: France
|
Posted: Thu Feb 09, 2023 11:18 am Post subject: |
|
|
I'm not scared of it, but Valentin won't understand your code if you don't explain it.
I think that one of the first goals of this forum is to teach TCL to others, but I'm peharps wrong _________________ Eggdrop community - French IRC network |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Thu Feb 09, 2023 1:40 pm Post subject: |
|
|
You are right, in this case here's a more traditional approach:
Code: |
bind join - * join:opbot
proc join:opbot { nick host hand chan } {
if {![isbotnick $nick]} return
if {[string equal -nocase $chan "#opers"]} {
set mode "+v"
} else {
set mode "+o"
}
putserv "SAMODE $chan $mode $::botnick"
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
|