| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat May 02, 2015 1:21 am Post subject: string match in text help |
|
|
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  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat May 02, 2015 1:13 pm Post subject: Re: string match in text help |
|
|
| 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 |
|
 |
|