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.

[SOLVED] Some support on a issue

Help for those learning Tcl or writing their own scripts.
Post Reply
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

[SOLVED] Some support on a issue

Post by Riddler »

Heya guys,

I need some support on a issue I`m having...

I want to make a code with some public commands like "save", "rehash", "restart", "chattr" and stuff like that but I need to make those commands to be called in to a specifig botnick...

I have several bot's on a channel ( 6 or 7 of them ) and I wan't to create a code that will responde if I call on of the bots nickname... so that I`ll manage them more easily... something like this
(08:14) <me> |egg .msg
(08:14) -|egg- SYNTAX: .msg <nick> [text]
(08:14) <me> |egg .msg Q auth
(08:14) -|egg- Sent message to Q
What should I bind in the code ? PUBM or PUB ?
I`ve tried bouth of them and the results are not what I`m wanting... :?

Here's a example of what I`m trying to do:

Code: Select all

bind pubm n .msg do:msg 

proc do:msg {nick uhost hand chan text} {
 if {[matchattr $hand n|N $chan]} {
    if {![isbotnick $nick]} {
      set who [lindex [split $text] 0]
      set txt [lrange $text 1 end]
      if {$who == ""} {
        puthelp "NOTICE $nick :SYNTAX:\002 .msg <nick> \[text\] \002"
        return 0 
      }
      if {$txt != ""} {
        putquick "PRIVMSG $who :$txt "
      } else {
         putserv "NOTICE $nick :SYNTAX:\002 .msg $who \[text\] \002"
      }
    }
 }
}
Is this the way the proc has to look for what I`m tryin to do ?

Waiting for some support/ideas from you guys.

Thanks :wink:
Last edited by Riddler on Sat Nov 28, 2009 8:08 pm, edited 2 times in total.
I am a man of few words, but many riddles
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

In your proc, $nick is the nick of the person triggering the command. What you want is a pub bind with the bot's nick as a keyword and then you'll have to parse $text to find the "command" part of the message.
Or you could make multiple pubm binds that include the botnick and command.
Have you ever read "The Manual"?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I'd also like to advise you against using such a public message command to auth with network services.
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

Post by Riddler »

Hello

@user: thanks for the ideas, I`ll see what I can do... the second part of your reply, with multiple binds sounds ok but I`ll see.. if there will be problems I`ll just put a reply here. :)

@metroid: I'm always auth with the network service, in this case... :wink:


P.S.: Thank you bouth for your advices :roll:
I am a man of few words, but many riddles
Post Reply