| View previous topic :: View next topic |
| Author |
Message |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 3:49 am Post subject: one command all channels |
|
|
Hi EveryOne!!!!
i want a tcl script for my bot which can send message to every channel it is in or to specific channel on a command such as
abcdbot is on #123 #xyz #678
the main channel is #123
and when i type .all HELLO PLEASE LISTEN
so the bot messages on every channel it is.
thanks |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue May 14, 2013 4:11 am Post subject: |
|
|
Try this
| Code: | bind PUB - .all all
proc all {nick uhost hand chan arg} {
if {![string match -nocase $chan "#123"]} { return }
foreach c [channels] {
if {[botonchan $c] && ($chan != $c)} {
putserv "PRIVMSG $chan :$arg"
}
}
} |
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Last edited by Madalin on Tue May 14, 2013 4:38 am; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue May 14, 2013 4:27 am Post subject: |
|
|
Madalin that's not what he asked for, besides, there's no need for the lrange.
| Code: |
bind pub * .all pub:all
proc pub:all {nick uhost hand chan text} {
if {![string match -nocase $chan "#123"]} return
foreach chn [channels] {
if {![botonchan $chn]} continue
puthelp "PRIVMSG $chn :$text"
}
}
|
Since you haven't mentioned any user flags I left to be available to all (the *), so adjust it to your needs.
Edit: Typo. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Tue May 14, 2013 2:45 pm; edited 1 time in total |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue May 14, 2013 4:39 am Post subject: |
|
|
I modifyed my copy now ... i read but as you saw i forgot about the main channel 'my mistake' the new version should work ok now _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 5:22 am Post subject: |
|
|
| thank you both of you and it was very quick! |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 5:23 am Post subject: |
|
|
| thank you both of you and it was very quick! |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue May 14, 2013 5:37 am Post subject: |
|
|
| Code: | set controlChan "#123"
bind pubm -|- "$controlChan .all *" pub:all
proc pub:all {nick uhost hand chan text} {
set text [join [lrange [split $text] 1 end]]
foreach ch [channels] {
if {![botonchan $ch] || [string equal $ch $::controlChan} continue
puthelp "PRIVMSG $chan :$text"
}
} |
An easier approach is using pubm style glob-masks to limit what has to be checked inside the procedure, simplifying the entire thing. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 8:14 am Post subject: |
|
|
can you add something by which on specific members can use this command?
like people with .chattr +P will be able to use the .all command |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue May 14, 2013 8:50 am Post subject: |
|
|
Just change what in bold with the flag letter you want (local)
bind pubm -|here _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 11:12 am Post subject: |
|
|
[17:11:43] Tcl error [pub:all]: missing close-bracket
this is the reply im getting in party line |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue May 14, 2013 11:57 am Post subject: |
|
|
try this...
| Code: | set controlChan "#123"
bind pubm -|- "$controlChan .all *" pub:all
proc pub:all {nick uhost hand chan text} {
set text [join [lrange [split $text] 1 end]]
foreach ch [channels] {
if {![botonchan $ch] || [string equal -nocase $ch $::controlChan]} continue
puthelp "PRIVMSG $chan :$text"
}
} |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 12:06 pm Post subject: |
|
|
| instead of replying to other channels, it is replying to the same channel. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue May 14, 2013 12:15 pm Post subject: |
|
|
Modify
| Code: |
puthelp "PRIVMSG $chan :$text"
|
with
| Code: |
puthelp "PRIVMSG $chn :$text"
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 12:27 pm Post subject: |
|
|
| same! + the both lines above are same to. |
|
| Back to top |
|
 |
true_life Voice
Joined: 14 May 2013 Posts: 11
|
Posted: Tue May 14, 2013 12:53 pm Post subject: |
|
|
| Tcl error [pub:all]: can't read "chn": no such variable |
|
| Back to top |
|
 |
|