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.

A Chanserv why command that msg the channel.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

A Chanserv why command that msg the channel.

Post by JohnJohnJohn »

can anyone help me out of making a script which msg the channel whenever a OP join the specified channel of what particular access that the OP has. If his an Aop or an Sop or maybe the Channel Founder. A /chanserv why <channel> <nick> command.. The bot will automatically msg the channel of what particular access does the Op have.


Example:

* ChanServ sets mode: +o JohnJohnJohn
#Then the bot responce
<botnick> JohnJohnJohn is an Aop in <channel> because of identification to the nickname JohnJohnJohn.


The main purpose for this script is to let the other users in the channel know what type of access does the OP has.


Can anyone help me about that?
watch your step. you might fall..
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

hi,

unfortunally i only know a way to make the bot recognize that someone is opped:

Code: Select all

bind mode - *o log:mode

proc log:mode {nick uhost hand channel args} {
putquick "PRIVMSG $channel :$nick is an operator in $channel because of identification to the nickname $nick"
}
maybe that gets you started. ;)
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

thanks for ya effort tadadadaaa i gladly appreciate it.. anyway the snippet runs good but there's something wrong on it. instead of the operator's nick the bot mentions the name of ChanServ

eg:

* ChanServ sets mode: +o JohnJohnJohn
-the bot replies-
<botnick> ChanServ is an operator in #channel because of identification to the nickname ChanServ

-And hopefully you can add some stuff like the bot will identify if what kind of access does the operator has.
For example if the Op is an Aop the bot will mention that he is an Aop.

eg: (JohnJohnJohn is Aop)

* ChanServ sets mode: +o JohnJohnJohn
-the bot replies-
<botnick> JohnJohnJohn is an Aop in #channel because of the identification to the nickname JohnJohnJohn

-As well as Sop and Founder access-

eg: (JohnJohnJohn is Sop)

* ChanServ sets mode: +o JohnJohnJohn
-the bot replies-
<botnick> JohnJohnJohn is an Sop in #channel because of the identification to the nickname JohnJohnJohn

eg: (JohnJohnJohn is Founder)

* ChanServ sets mode: +o JohnJohnJohn
-the bot replies-
<botnick> JohnJohnJohn has FOUNDER access to #channel. Reason: Identification to the founder's nickname, JohnJohnJohn.

-or-

* ChanServ sets mode: +o JohnJohnJohn
-the bot replies-
<botnick> JohnJohnJohn has FOUNDER access to #channel. Reason: Identification to services with the channel password.


--- Hope ya can help me out of that, am looking forward on it. :D
watch your step. you might fall..
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

oops

try this:

Code: Select all

bind mode - *o log:mode 

proc log:mode {nick uhost hand channel args} { 

putquick "PRIVMSG $channel :$nick sets $args in $channel because of the identification to his nickname." 

}

sry, i really dont know, how this aop/sop-stuff works. maybe "bind mode - *aop log:mode" and "bind mode - *sop log:mode" does the trick.
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

hrmm that works fine than the previous one but there's still an error, even if i sets mode -o the bot still mention that thing.. and if the bot deop itself it mentions the same thing.. Anyway thanks :D i still appreciate it..[/b]
watch your step. you might fall..
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

=)

try this:

Code: Select all

bind mode - +o log:mode 

proc log:mode {nick uhost hand channel args} { 
global botnick

if {$nick == $botnick} {return}

putquick "PRIVMSG $channel :$nick sets $args in $channel because of the identification to his nickname." 

}
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Read about how to use bind mode:
http://tcl.powersource.cx/eggtclh11.php
MODE (stackable) bind mode <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <mode-change> <victim>
Description: mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, such as "+m" or "-o". victim will show the argument of the mode change (for o/v/b/e/I) or "" if the set mode does not take an argument. Flags are ignored. The bot's automatic response to a mode change will happen AFTER all matching Tcl procs are called. The mask will be matched against '#channel +/-modes' and can contain wildcards.
If it is a server mode, nick will be "", user@host is the server name, and handle is *.
Using $args is a special case in tcl. Refer to: http://www.tcl.tk/man/tcl8.4/TclCmd/proc.htm :
There is one special case to permit procedures with variable numbers of arguments. If the last formal argument has the name args, then a call to the procedure may contain more actual arguments than the procedure has formals. In this case, all of the actual arguments starting at the one that would be assigned to args are combined into a list (as if the list command had been used); this combined value is assigned to the local variable args.
You probably want to add and use the $victim var to get the nick whose mode was changed..

Code: Select all

proc log:mode {nick uhost hand channel mode victim} {
putquick "PRIVMSG $channel :$nick sets $mode in $channel for $victim because of the identification to his nickname." 
}
etc.
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

i searched google and i found one similar on the script that i want but the difference is that upon a +o mode by chanserv the script sends out a why to chanserv and put the result in the file why.txt instead of sending out the informations in the channel. Here's the one i found in google;


package require Tcl 8.0

bind mode - * mode:why

bind notc - * notc:why

proc mode:why { nick uhost hand chan mchange victim } {

# check mode change

if { $mchange != "+o" } { return 0 }

# check nick and uhost opper is chanserv

if { $nick != "ChanServ" } { return 0 }

if { $uhost != "service@dal.net" } { return 0 }

# send a "why" message to chanserv

set chanserv chanserv@services.dal.net

puthelp "PRIVMSG $chanserv :WHY $chan $victim"

}

proc notc:why { nick uhost hand text dest} {

global botnick

# destination must be the bot

if { $dest != $botnick } { return 0 }

# check nick and uhost is chanserv

if { $nick != "ChanServ" } { return 0 }

if { $uhost != "service@dal.net" } { return 0 }

# a WHY result?

set matchrule {* has * access to *}

if { ![string match $matchrule $text] } { return 0 }

# save the why result to fule

set cformat {%d-%b-%Y-%H:%M}

set stamp [clock format [clock seconds] -format $cformat]

set fd [open WHY.txt a+]

puts $fd "$stamp $text"

close $fd

}


I tried to edit that one but still the informations are sent in the partyline not in the channel where the Op joined. Am really a stranger in TCL i just find ways to learn on it..

Anyway thanks for the sites u gave rosc2112, that could help me to get start through.. But hopefully someone could help me about the script.. :lol:
watch your step. you might fall..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

@JohnJohnJohn: Re-edit your post correctly using tags (re-pasting the entire code) as it will make it easier to read.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

ok here is the code.. :) i found that one when i searched google.. It's more efficient for me if the bot will message the channel of what particular access does the op has rather than putting the informations in why.txt
Whether it's Aop Sop or Founder..

Code: Select all

bind mode - * mode:why

bind notc - * notc:why

proc mode:why { nick uhost hand chan mchange victim } {

   # check mode change

   if { $mchange != "+o" } { return 0 }

   # check nick and uhost opper is chanserv

   if { $nick != "ChanServ" } { return 0 }

   if { $uhost != "service@dal.net" } { return 0 }

   # send a "why" message to chanserv

   set chanserv chanserv@services.dal.net

   puthelp "PRIVMSG $chanserv :WHY $chan $victim"

}

proc notc:why { nick uhost hand text dest} {

   global botnick

   # destination must be the bot

   if { $dest != $botnick } { return 0 }

   # check nick and uhost is chanserv

   if { $nick != "ChanServ" } { return 0 }

   if { $uhost != "service@dal.net" } { return 0 }

   # a WHY result?

   set matchrule {* has * access to *}

   if { ![string match $matchrule $text] } { return 0 }

   # save the why result to fule

   set cformat {%d-%b-%Y-%H:%M}

   set stamp [clock format [clock seconds] -format $cformat]

   set fd [open WHY.txt a+]

   puts $fd "$stamp $text"

   close $fd

}
watch your step. you might fall..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

The following code will message the channel instead of writing to a file.

Code: Select all

bind mode - * mode:why

bind notc - * notc:why

proc mode:why { nick uhost hand chan mchange victim } {

   # check mode change

   if { $mchange != "+o" } { return 0 }

   # check nick and uhost opper is chanserv

   if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }

   # send a "why" message to chanserv

   set chanserv chanserv@services.dal.net

   puthelp "PRIVMSG $chanserv :WHY $chan $victim"

}

proc notc:why { nick uhost hand text {dest ""}} {

   global botnick

   set text [stripcodes b $text]

   # destination must be the bot

   if { $dest != $botnick } { return 0 }

   # check nick and uhost is chanserv

   if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }

   # a WHY result?

   set matchrule {* has * access to *}

   if { ![string match $matchrule $text] } { return 0 }

   set channel [string trim [lindex [split $text] 5] .]

   putserv "privmsg $channel :\00306$text"
}
An alternative to messaging the channel is to send an Op notice:

Replace:

Code: Select all

putserv "privmsg $channel :\00306$text"
with:

Code: Select all

putserv "NOTICE @$channel :\00306$text"
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

There it goes Alchera that hits the spot.. :D it suits what am lookin for.. thanks for the effort :) but anyway i would like to add some fancy stuff on it, is there any way that i can customize the $text result? For instance if an Aop joined the channel the bot will message different message and as well as Sop and Founder..

example:

(Aop joins the chan)
* ChanServ sets mode: +o JohnJohnJohn
<botnick> JohnJohnJohn is just an Aop in this <#channel>

(Sop joins the chan)
* ChanServ sets mode: +o JohnJohnJohn
<botnick> Here it comes the Sop of the channel <#channel> welcome JohnJohnJohn!

(Founder joins the chan)
* ChanServ sets mode: +o JohnJohnJohn
<botnick> All rise now! The Founder has arrived! All hail JohnJohnJohn!


Something like this to make the bot more dynamic and more colorful to look..:)
watch your step. you might fall..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Code: Select all

proc notc:why { nick uhost hand text {dest ""}} {

   global botnick

   set text [stripcodes b $text]

   # destination must be the bot

   if { $dest != $botnick } { return 0 }

   # check nick and uhost is chanserv

   if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }

   # a WHY result?

   set matchrule {* has * access to *}

   if { ![string match $matchrule $text] } { return 0 }

   set channel [string trim [lindex [split $text] 5] .]

   if {[string match [string tolower [lindex [split $text] 2]] "founder"]} {
       set text "All rise now! The Founder has arrived! All hail [lindex [split $text] 0]"
   }

   if {[string match [string tolower [lindex [split $text] 2]] "sop"]} {
       set text "Here it comes the Sop of $channel, Welcome [lindex [split $text] 0]"
   }

   if {[string match [string tolower [lindex [split $text] 2]] "aop"]} {
       set text "[lindex [split $text] 0] is just an AOp in $channel"
   }

   putserv "privmsg $channel :\00306$text"
}
Those that wish to use this script but want to use the standard DALnet reply minus the " Channel Frozen: NO" bit:

Code: Select all

....
   set channel [string trim [lindex [split $text] 5] .]

   set text [regsub { Channel Frozen: NO} $text ""]

   putserv "NOTICE @$channel :\00306$text"
....
Also, if the following error is encountered:
Tcl error [notc:why]: extra characters after close-quote
.. simply change:

Code: Select all

proc notc:why { nick uhost hand text {dest ""}}
.. to:

Code: Select all

proc notc:why { nick uhost hand text dest}
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
J
JohnJohnJohn
Voice
Posts: 20
Joined: Mon Sep 24, 2007 12:20 pm
Location: Philippines
Contact:

Post by JohnJohnJohn »

This is exactly what i want.. Thanks for your effort Alchera! :D
watch your step. you might fall..
Post Reply