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 

string match in text help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat May 02, 2015 1:21 am    Post subject: string match in text help Reply with quote

I need to get the text that follows the word 'Founder:' and the word 'Registered:'

Code:
set canal_admin "#channel1"
set canal_radio "#channel2"

bind pub * !request ver_chan
bind msgm - * info:channel


proc ver_chan {nick uhost hand chan text} {
   global canal_admin canal_djs canal_radio
   if {[string tolower $chan] != [string tolower $canal_radio]} {return 0}
    if {[llength $text] != 1} { putmsg $canal_radio "canal invalido XD"; return }
   set canal [lindex [split $text] 0]
##Send your query to the bot CHaN by the channel info.
 putserv "PRIVMSG chan :info $canal"
}
proc info:channel {nick CHaN!-@- hand text} {
global canal_admin
 if {[lsearch -exact -nocase "*Founder:*" $text]} {
###set founder ?????????
###set dateregistred ?????????
  putmsg $canal_admin "$text"
   } else {
return
}}

<oper> !request #test
result:
Quote:
02:03 @mybot ¦ Channel information #test:
02:03 @mybot ¦ Status: ACTIVE
02:03 @mybot ¦ Founder: Susan
02:03 @mybot ¦ Description: Private channel testing
02:03 @mybot ¦ Registered: 19:57:24 09/Feb/2015 CET
02:03 @mybot ¦ Last used: 05:52:26 02/May/2015 CEST
02:03 @mybot ¦ Opcion: Retention topic,Secure
02:03 @mybot ¦ Lock modes: +s-i
02:03 @mybot ¦ End INFO channel #test.

I need to find in the text the nick of the founder and the date of registration of the channel.
Then, store the data in variables, which then will store in a file.
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sat May 02, 2015 1:13 pm    Post subject: Re: string match in text help Reply with quote

juanamores wrote:
I need to get the text that follows the word 'Founder:' and the word 'Registered:'


This is one way.
Play around with this. You'll get the idea.

Code:


proc info:channel {nick CHaN!-@- hand text} {
global canal_admin

        if {[lindex [split $text] 0] eq "Founder:"} {
                putmsg $canal_admin "Founder is: [lindex [split $text] 1]"
          }

        if {[lindex [split $text] 0] eq "Registered:"} {
                putmsg $canal_admin "Registered is: [lindex [split $text] 1]"
        }
        return 0

}

_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
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 -> Scripting Help 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