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 

A Chanserv why command that msg the channel.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Tue Sep 25, 2007 8:16 am    Post subject: A Chanserv why command that msg the channel. Reply with quote

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..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Thu Oct 04, 2007 6:39 am    Post subject: Reply with quote

hi,

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

Code:

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. Wink
Back to top
View user's profile Send private message Visit poster's website
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Thu Oct 04, 2007 10:10 pm    Post subject: Reply with quote

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. Very Happy
_________________
watch your step. you might fall..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Fri Oct 05, 2007 9:57 am    Post subject: Reply with quote

oops

try this:


Code:
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.
Back to top
View user's profile Send private message Visit poster's website
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Fri Oct 05, 2007 10:59 am    Post subject: Reply with quote

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 Very Happy i still appreciate it..[/b]
_________________
watch your step. you might fall..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Fri Oct 05, 2007 1:24 pm    Post subject: Reply with quote

=)

try this:

Code:
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."

}
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Oct 05, 2007 1:48 pm    Post subject: Reply with quote

Read about how to use bind mode:
http://tcl.powersource.cx/eggtclh11.php
Quote:
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 :
Quote:
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:

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.
Back to top
View user's profile Send private message
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Sat Oct 06, 2007 1:20 am    Post subject: Reply with quote

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.. Laughing
_________________
watch your step. you might fall..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sat Oct 06, 2007 4:11 am    Post subject: Reply with quote

@JohnJohnJohn: Re-edit your post correctly using [code][/code] 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
Back to top
View user's profile Send private message Visit poster's website
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Sat Oct 06, 2007 10:38 am    Post subject: Reply with quote

ok here is the code.. Smile 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:
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..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sat Oct 06, 2007 7:18 pm    Post subject: Reply with quote

The following code will message the channel instead of writing to a file.
Code:
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:
putserv "privmsg $channel :\00306$text"

with:
Code:
putserv "NOTICE @$channel :\00306$text"

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Sun Oct 07, 2007 2:02 am    Post subject: Reply with quote

There it goes Alchera that hits the spot.. Very Happy it suits what am lookin for.. thanks for the effort Smile 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..Smile
_________________
watch your step. you might fall..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Oct 08, 2007 5:57 pm    Post subject: Reply with quote

Code:
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:
....
   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:
Quote:
Tcl error [notc:why]: extra characters after close-quote

.. simply change:
Code:
proc notc:why { nick uhost hand text {dest ""}}

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

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
JohnJohnJohn
Voice


Joined: 24 Sep 2007
Posts: 20
Location: Philippines

PostPosted: Tue Oct 09, 2007 11:06 pm    Post subject: Reply with quote

This is exactly what i want.. Thanks for your effort Alchera! Very Happy
_________________
watch your step. you might fall..
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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