This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

sending a message to all ops on a channel [Solved]

Help for those learning Tcl or writing their own scripts.
Post Reply
j
jeremie
Voice
Posts: 9
Joined: Thu Aug 30, 2007 3:35 pm

sending a message to all ops on a channel [Solved]

Post by jeremie »

I have been writing a script which warns somebody if they say a banned word on a channel.

It sends a warning to that person and I want it to send a private message to all ops on the channel.

I know how to send it as a notice but the ops would rather have it sent to them as a private message.

I have looked in as many places I can think of and not found any solution.

Will somebody please help me with this?
Last edited by jeremie on Mon Sep 24, 2007 11:10 am, edited 1 time in total.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Re: sending a message to all ops on a channel

Post by TCL_no_TK »

Try this

Code: Select all

foreach target [chanlist $dest] {
 if {[isop $target $dest]} {
  puthelp "PRIVMSG $target :$warning"
 }
}
Please set dest to what the #channel_name is, and warning to the message it will send to the ops. You can also make this into a proc by doing.

Code: Select all

proc msg_ops {text} {
 set dest [lindex [split $text] 0]
  set warn [join [lrange [split $text] 1 end]]
   foreach target [chanlist $dest] {
    if {[isop $target $dest]} {
     puthelp "PRIVMSG $target :$warn"
    }
   }; return 1
}
The use msg_ops "#channel some_warning_message" in your script to send a private warning to all ops on the channel. :) Hope it helps.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

You're msg_ops proc is bad, you should check the dest syntax correctly, see if the channel is added etc...

Code: Select all

proc msg_ops {channel msg} {
    if {![validchan $channel]} { return }
    if {$msg == ""} { return }
    foreach user [chanlist $channel] {
        if {$user != "" && [isop $user $channel]} {
            puthelp "PRIVMSG $user :[join $msg]"
        }
    }
    return 1
}
r0t3n @ #r0t3n @ Quakenet
j
jeremie
Voice
Posts: 9
Joined: Thu Aug 30, 2007 3:35 pm

[Solved] sending a message to all ops on channel

Post by jeremie »

I tried that and it worked perfectly.

Thank you TCL_no_TK and Tosser^^

:)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You will need this if the bot is op, so it doesn't need to message itself, heh.

Code: Select all

proc msg_ops {channel msg} {
    if {![validchan $channel]} { return }
    if {$msg == ""} { return }
    foreach user [chanlist $channel] {
        if {$user != "" && [isop $user $channel] && ![isbotnick $user]} {
            puthelp "PRIVMSG $user :[join $msg]"
        }
    }
    return 1
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
j
jeremie
Voice
Posts: 9
Joined: Thu Aug 30, 2007 3:35 pm

Post by jeremie »

I'm not sure how you knew I was trying to work that one out too.

I have added that now and it's even better than before.

Thank you awyeah.

:)
Post Reply