egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

one command all channels
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 3:49 am    Post subject: one command all channels Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue May 14, 2013 4:11 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue May 14, 2013 4:27 am    Post subject: Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue May 14, 2013 4:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 5:22 am    Post subject: Reply with quote

thank you both of you and it was very quick!
Back to top
View user's profile Send private message
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 5:23 am    Post subject: Reply with quote

thank you both of you and it was very quick!
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue May 14, 2013 5:37 am    Post subject: Reply with quote

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
View user's profile Send private message
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 8:14 am    Post subject: Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue May 14, 2013 8:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 11:12 am    Post subject: Reply with quote

[17:11:43] Tcl error [pub:all]: missing close-bracket


this is the reply im getting in party line
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Tue May 14, 2013 11:57 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 12:06 pm    Post subject: Reply with quote

instead of replying to other channels, it is replying to the same channel.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue May 14, 2013 12:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 12:27 pm    Post subject: Reply with quote

same! + the both lines above are same to.
Back to top
View user's profile Send private message
true_life
Voice


Joined: 14 May 2013
Posts: 11

PostPosted: Tue May 14, 2013 12:53 pm    Post subject: Reply with quote

Tcl error [pub:all]: can't read "chn": no such variable
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber