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 

NICK/CHAN INFO script (SOLVED)
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
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Sun Apr 29, 2007 10:45 am    Post subject: NICK/CHAN INFO script (SOLVED) Reply with quote

have tried search on the archives and i havent found one so i am requesting this if this possible. Can any of u guys share a TCl script that will do this:

> first a user publicly types !nickinfo <targetnick>
> the bot then does a /ns info <nick> and outputs the result to the nick that requested the info?
> same logic goes to the public trigger !chaninfo <#chan> which makes the bot do a /cs info #chan and outputs the result to the requestor.

i would appreciate any help that anyone can spare. or at least guide me to a script that i can add or modify to do this. i am not entirely a noob on TCl... this is just way way out of my leaque right now. thanks to you guys in advance.
_________________
let he who is without stone cast the first sin


Last edited by masheen on Wed May 02, 2007 3:38 am; edited 1 time in total
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Sun Apr 29, 2007 5:00 pm    Post subject: Reply with quote

Show us the reply from NS and CS when you perfom such commands
Back to top
View user's profile Send private message Visit poster's website
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Sun Apr 29, 2007 8:25 pm    Post subject: Reply with quote

ok first if i query the bot with !nickinfo <somenick> the bot would then do a /nickserv info <somenick> and the output thru query message from the bot would have been:
Quote:
<botname> -NickServ- Info for LordAshe:
<botname> -NickServ- (Currently on IRC) For extra info: /whois LordAshe
<botname> -NickServ- Last seen address : Ashe@apocrypha.jirehnet.net
<botname> -NickServ- Last seen time : Sun 29-Apr-2007 17:52:16 UTC
<botname> -NickServ- Time registered : Tue 13-Feb-2007 12:14:14 UTC
<botname> -NickServ- Time now : Mon 30-Apr-2007 00:12:15 UTC
<botname> -NickServ- Options: Enforced
<botname> -NickServ- *** End of Info ***


the same if i query the bot with !chaninfo <somechan> after which the bot performs a /chanserv info #somechan and queries me with this info:
Quote:
<botname> -ChanServ- Info for #icon:
<botname> -ChanServ- Founder : LordAshe (enforcer@microsoft.net-ph.com)
<botname> -ChanServ- Mode Lock : +nt-ispklmc
<botname> -ChanServ- Last Topic : 'This is the channel Topic' (LordAshe)
<botname> -ChanServ- Description: PrivateChannel
<botname> -ChanServ- Options : SecuredOps, Ident, Verbose, Topic Lock(S)
<botname> -ChanServ- Memo Level : AOP
<botname> -ChanServ- Registered : Wed 17-Jan-2007 02:39:31 UTC
<botname> -ChanServ- Last opping: Sun 29-Apr-2007 16:33:07 UTC
<botname> -ChanServ- *** End of Info ***

i hope m clear with this. thanks again for the help. Smile i hope sum1 can come up with this nifty and very usable script. Smile (my server is DALNET by the way in case if the servers are an issue)
_________________
let he who is without stone cast the first sin
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Apr 30, 2007 6:48 am    Post subject: Reply with quote

Code:
## Give your channel name here.
set scriptchannel "#channel"

bind pub -|- !nickinfo script:text1
bind pub -|- !chaninfo script:text2
bind notc -|- "*Info for *" script:notices1
bind notc -|- "*For extra info*" script:notices1
bind notc -|- "*Last seen address*" script:notices1
bind notc -|- "*Last seen time*" script:notices1
bind notc -|- "*Time registered*" script:notices1
bind notc -|- "*Time now*" script:notices1
bind notc -|- "*URL*" script:notices1
bind notc -|- "*Options*" script:notices1
bind notc -|- "*Founder*" script:notices1
bind notc -|- "*Mode Lock*" script:notices1
bind notc -|- "*Last Topic*" script:notices1
bind notc -|- "*Description:*" script:notices1
bind notc -|- "*Memo Level*" script:notices1
bind notc -|- "*Registered*" script:notices1
bind notc -|- "*Last opping*" script:notices1
bind notc -|- "*End of Info*" script:notices1


proc script:text1 { nick host handle chan text } {
global scriptchannel user
set text [split $text]
set user [lindex $text 0]
if {$user == ""} {puthelp "NOTICE $nick :You need to supply a nickname."; return}
putserv "PRIVMSG nickserv@services.dal.net :info $user"
}

proc script:text2 { nick host handle chan text } {
global scriptchannel
set text [split $text]
set text [lindex $text 0]
if {$text == ""} {puthelp "NOTICE $nick :You need to supply a channel name."; return}
putserv "PRIVMSG chanserv@services.dal.net :info $text"
}

proc script:notices1 {nick uhost hand text dest} {
global scriptchannel
putquick "PRIVMSG $scriptchannel :$text"
}

putlog "!nickinfo and !chaninfo script loaded by iamdeath."


Enjoy.
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 9:32 am    Post subject: Reply with quote

You really want it to trigger in any channel, but write to a preset channel (regardless of the channel it was triggered in)?

@iamdeath: there's no point in making the variable "user" access globalspace within script:text1, and neither "scriptchannel" in both script:text1 and script:text2
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Mon Apr 30, 2007 11:20 am    Post subject: Reply with quote

yes its working! i think i can manage the rest of the changes and some alterations. you are good iamdeath Smile it is people like u that inspire us begginers. thanks for the help...lastly can you add a !whois <nick> trigger for that? the bot after doing a /whois <nick> will have an output like this:

Quote:
<botnick> LordAshe is enforce@oper.c0ntrol.com * root|fix
<botnick> LordAshe on @#adzu +#icon #tclhelp
<botnick> LordAshe using punch.va.us.dal.net Spelling is a lossed art.
<botnick> LordAshe has identified for this nick
<botnick> LordAshe has been idle 4mins 54secs, signed on Mon Apr 30 03:36:19
<botnick> LordAshe End of /WHOIS list.


pls bear with the request.. if its too much just say so... the help u gave is actually enuf already... but will appreciate it if u can add this one up. thanks dude.
_________________
let he who is without stone cast the first sin
Back to top
View user's profile Send private message
Alchera
Revered One


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

PostPosted: Mon Apr 30, 2007 11:21 am    Post subject: Reply with quote

@masheen: See arfer on DALnet he has written the two scripts you requested and believe me, far more elegant than what has been offered. arfer may share.

Just tell him I suggested you see him.
_________________
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
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Apr 30, 2007 12:30 pm    Post subject: Reply with quote

nml375 wrote:
You really want it to trigger in any channel, but write to a preset channel (regardless of the channel it was triggered in)?

@iamdeath: there's no point in making the variable "user" access globalspace within script:text1, and neither "scriptchannel" in both script:text1 and script:text2


Thanks alot for pointing that out nml, actually yes I don't need to make $user global at that time I was doing some experiences so I used that it in Global then I forgot to remove it.
Back to top
View user's profile Send private message Visit poster's website
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Mon Apr 30, 2007 12:35 pm    Post subject: Reply with quote

um guys...its working and all but the problem is that it tends to become annoying when 2 or more people are trying to use the service... maybe change it to PRIVMSG $nick insted?

Code:
proc script:notices1 {nick uhost hand text dest} {
global scriptchannel
putquick "PRIVMSG $scriptchannel :$text"
}


the only problem is is that when i change $scriptchannel to $nick, the bot no longer responds... can u guys shed light on this one? oh n dont wori bout the global trigger... the bot sits in just a channel so no worries. and if possible, can u guys add up a !whois <nick> trigger? i understand u will nid to capture raw replys from the server for this one... thanks thanks thanks a lot for anyone who offers help on this one.
_________________
let he who is without stone cast the first sin
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Mon Apr 30, 2007 12:47 pm    Post subject: Reply with quote

you can find "!whois" scripts in the tcl archive.
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Apr 30, 2007 12:54 pm    Post subject: Reply with quote

Quote:

bind pub -|- !nickinfo script:text1
bind pub -|- !chaninfo script:text2
bind notc -|- "*Info for *" script:notices1
bind notc -|- "*For extra info*" script:notices1
bind notc -|- "*Last seen address*" script:notices1
bind notc -|- "*Last seen time*" script:notices1
bind notc -|- "*Time registered*" script:notices1
bind notc -|- "*Time now*" script:notices1
bind notc -|- "*URL*" script:notices1
bind notc -|- "*Options*" script:notices1
bind notc -|- "*Founder*" script:notices1
bind notc -|- "*Mode Lock*" script:notices1
bind notc -|- "*Last Topic*" script:notices1
bind notc -|- "*Description:*" script:notices1
bind notc -|- "*Memo Level*" script:notices1
bind notc -|- "*Registered*" script:notices1
bind notc -|- "*Last opping*" script:notices1
bind notc -|- "*End of Info*" script:notices1


proc script:text1 { nick host handle chan text } {
global towhom
set text [split $text]
set text [lindex $text 0]
set towhom "$nick"
if {$text == ""} {puthelp "NOTICE $nick :You need to supply a nickname."; return}
putserv "PRIVMSG nickserv@services.dal.net :info $text"
}

proc script:text2 { nick host handle chan text } {
global towhom
set text [split $text]
set text [lindex $text 0]
set towhom "$nick"
if {$text == ""} {puthelp "NOTICE $nick :You need to supply a channel name."; return}
putserv "PRIVMSG chanserv@services.dal.net :info $text"
}

proc script:notices1 {nick uhost hand text dest} {
global towhom
putquick "PRIVMSG $towhom :$text"
}

putlog "!nickinfo and !chaninfo script loaded by iamdeath."



I think it should now msg nickname, try it out and let me know. As far as /whois I don't know about it I will read it understand it and then if I get it I will write on it Very Happy
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 1:14 pm    Post subject: Reply with quote

The problem here, is that $nick would be NS (since NS is the one triggering this binding), rather than the nick originally requesting this information. This would require that you keep track of the original requester for the duration of the request.

I believe this code should do the trick, while also using proper queues, and not breaking the rfc that much (yes, we do respond to NOTICE's, but atleast we don't respond with PRIVMSG's). List of bindings taken from previous post by iamdeath.

Code has not been tested, but feel free to dig for bugs, flaws, etc :p

Code:
proc get_ns {nick host hand text {dest ""}} {
 global get_ns
 if {![info exists get_ns(target)] || [string equal $get_ns(target) ""]} {return 0}
 puthelp "NOTICE $get_ns(target) :$text"
 if {[string match "*End of Info*" $text]} {
  unset get_ns(target)
  if {[info exists get_ns(queue)] && [llength $get_ns(queue)] > 0} {
   set next [lindex $get_ns(queue) 0]
   set get_ns(queue) [lreplace $get_ns(queue) 1 end]
   set get_ns(target) [lindex $next 0]
   putserv "PRIVMSG [lindex $next 1] :info [lindex $next 2]"
  }
 }
}

proc request_ns {nick host hand chan text} {
 global get_ns
 if {[string lenght $text] <= 0} {
  puthelp "NOTICE $nick :You must supply a nickname."
  return 1
 }
 if {[info exists get_ns(target)] && ![string equal $get_ns(target) ""]} {
  puthelp "NOTICE $nick :There is already a request in progress. Your request has been queued."
  lappend get_ns(queue) [list $nick "nickserv@services.dal.net" [lindex [split $text] 0]"]
 } else {
  set get_ns(target) $nick
  putserv "PRIVMSG nickserv@services.dal.net :info [lindex [split $text] 0]"
  puthelp "NOTICE $nick :Request sent."
 }
}

proc request_cs {nick host hand chan text} {
 global get_ns
 if {[string lenght $text] <= 0} {
  puthelp "NOTICE $nick :You must supply a nickname."
  return 1
 }
 if {[info exists get_ns(target)] && [string equal $get_ns(target) ""]} {
  puthelp "NOTICE $nick :There is already a request in progress. Your request has been queued."
  lappend get_ns(queue) [list $nick "chanserv@services.dal.net" [lindex [split $text] 0]"]
 } else {
  set get_ns(target) $nick
  putserv "PRIVMSG chanserv@services.dal.net :info [lindex [split $text] 0]"
  puthelp "NOTICE $nick :Request sent."
 }
}

bind pub -|- !nickinfo request_ns
bind pub -|- !chaninfo request_cs
bind notc -|- "*Info for *" get_ns
bind notc -|- "*For extra info*" get_ns
bind notc -|- "*Last seen address*" get_ns
bind notc -|- "*Last seen time*" get_ns
bind notc -|- "*Time registered*" get_ns
bind notc -|- "*Time now*" get_ns
bind notc -|- "*URL*" get_ns
bind notc -|- "*Options*" get_ns
bind notc -|- "*Founder*" get_ns
bind notc -|- "*Mode Lock*" get_ns
bind notc -|- "*Last Topic*" get_ns
bind notc -|- "*Description:*" get_ns
bind notc -|- "*Memo Level*" get_ns
bind notc -|- "*Registered*" get_ns
bind notc -|- "*Last opping*" get_ns
bind notc -|- "*End of Info*" get_ns


Edit: Slight logical error fixed, that would render the script actionless (would only enqueue new request without actually processing the queue)
_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Mon Apr 30, 2007 1:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 1:28 pm    Post subject: Reply with quote

A slightly updated version reducing repeated code:
Code:
proc get_ns {nick host hand text {dest ""}} {
 global get_ns
 if {[info exists get_ns(target)] && ![string equal $get_ns(target) ""]} {return 0}
 puthelp "NOTICE $get_ns(target) :$text"
 if {[string match "*End of Info*" $text]} {
  unset get_ns(target)
  if {[info exists get_ns(queue)] && [llength $get_ns(queue)] > 0} {
   set next [lindex $get_ns(queue) 0]
   set get_ns(queue) [lreplace $get_ns(queue) 1 end]
   set get_ns(target) [lindex $next 0]
   putserv "PRIVMSG [lindex $next 1] :info [lindex $next 2]"
  }
 }
}

proc request_ns {nick host hand chan text} {
 global get_ns lastbind
 if {[string lenght $text] <= 0} {
  puthelp "NOTICE $nick :You must supply a nickname."
  return 1
 }
 switch -- $lastbind {
  "!nickinfo" {set target nickserv@services.dal.net}
  "!chaninfo" {set target chanserv@services.dal.net}
  default {return}
 }
 if {![info exists get_ns(target)] || [string equal $get_ns(target) ""]} {
  puthelp "NOTICE $nick :There is already a request in progress. Your request has been queued."
  lappend get_ns(queue) [list $nick $target [lindex [split $text] 0]"]
 } else {
  set get_ns(target) $nick
  putserv "PRIVMSG $target :info [lindex [split $text] 0]"
  puthelp "NOTICE $nick :Request sent."
 }
}

bind pub -|- !nickinfo request_ns
bind pub -|- !chaninfo request_ns
bind notc -|- "*Info for *" get_ns
bind notc -|- "*For extra info*" get_ns
bind notc -|- "*Last seen address*" get_ns
bind notc -|- "*Last seen time*" get_ns
bind notc -|- "*Time registered*" get_ns
bind notc -|- "*Time now*" get_ns
bind notc -|- "*URL*" get_ns
bind notc -|- "*Options*" get_ns
bind notc -|- "*Founder*" get_ns
bind notc -|- "*Mode Lock*" get_ns
bind notc -|- "*Last Topic*" get_ns
bind notc -|- "*Description:*" get_ns
bind notc -|- "*Memo Level*" get_ns
bind notc -|- "*Registered*" get_ns
bind notc -|- "*Last opping*" get_ns
bind notc -|- "*End of Info*" get_ns


Edit: Slight logical error fixed, that would render the script actionless (would only enqueue new request without actually processing the queue).
Edit: Forgot to make lastbind global.
_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Mon Apr 30, 2007 1:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Apr 30, 2007 1:33 pm    Post subject: Reply with quote

Code:

set mychannel "#channel"
bind pub -|- !whois script:whois

proc script:whois { nick host handle chan text } {
set text [split $text]
set user [lindex $text 0]
if {$user == ""} {puthelp "NOTICE $nick :You need to supply a nickname."; return}
putquick "WHOIS $user"
}

bind raw - "311" script:whois1
bind raw - "312" script:whois1
bind raw - "318" script:whois1
bind raw - "319" script:whois1
bind raw - "401" script:whois1

proc script:whois1 {from key args} {
global mychannel
set text [split $args]
set topaste [lrange $text 1 end]
regsub -all {\{} $topaste "" topaste
regsub -all {\}} $topaste "" topaste
regsub -all {\\} $topaste "" topaste
putserv "PRIVMSG $mychannel :$topaste"
}

putlog "!whois script loaded by iamdeath."


Enjoy your whois script, tested and working fine on Undernet.

nml awsome work, wish we could write codes like that too Razz
Good job
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 1:41 pm    Post subject: Reply with quote

It's not that hard, you simply has to make yourself one with the code Wink

Actually, it's a matter of practice and experience.. Keep at it, and you'll be there sooner or later Smile
_________________
NML_375, idling at #eggdrop@IrcNET
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