| View previous topic :: View next topic |
| Author |
Message |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Sun Feb 14, 2010 9:48 am Post subject: [solved] Regex help - cant get my head around this |
|
|
i have a script running i one channel that has lots of spam info in , that relays certain parts of that info to another channel over the bot net,
but i know need somthing with regex /me is a n00b with regex,
the bots name i want to monitor is inner-b0t and when this line is said on my $chan it will strip out just the request id number, ie :
| Code: | | <inner-b0t> That was awesome [*Anonymous*] Shall we do it again? ReqId:[126556] |
and then MSG $another_channel
so in $another_channel it would read
| Code: | | <inner-b0t> -send 126556 |
the line is always the same but the reqid is different and i have no clue how to script this
thanks guys hope someone can help me  _________________ NON geeky!! http://gotcode4u.com/
Last edited by doggo on Mon May 24, 2010 4:26 pm; edited 1 time in total |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Mon Feb 15, 2010 12:37 pm Post subject: |
|
|
| Code: | set the_nick "tomekk"
##############################################
bind pubm -|- "*" check_line
proc check_line { nick uhost hand chan arg } {
global the_nick
if {$the_nick == $nick} {
if {[regsub -all -nocase {.*ReqId:\[(.*)\].*} $arg {\1} arg]} {
putquick "PRIVMSG $chan :ReqId echo -> $arg"
}
}
}
putlog "whatever.tcl loaded" |
| Quote: | 17:36:48 <@tomekk> That was awesome [*Anonymous*] Shall we do it again? ReqId:[126556]
17:36:48 < botty> ReqId echo -> 126556 |
|
|
| Back to top |
|
 |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Mon Feb 15, 2010 5:51 pm Post subject: |
|
|
| Code: | [09:39pm] <<inner-b0t> That was awesome [*Anonymous*] Shall we do it again? ReqId:[126675]
[09:39pm] <hub> -sendnzb 126675 |
thanks tomekk your a star
just one more quick question
how would implement a 2 sec delay for the PRIVMSG response
thanks again too it works a treat
edit:
would it be possible for it to ignore this line
| Code: | | <inner-b0t> Request Expired after 30 days ReqId:[122673] |
as it responds in channel with
| Code: | [12:20am] <inner-b0t> Request Expired after 30 days ReqId:[122673] [FULL 0 this.is.a.test]
[12:20am] <hub> -sendnzb 122673] [FULL 0 this.is.a.test |
thanks for the help  _________________ NON geeky!! http://gotcode4u.com/ |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Tue Feb 16, 2010 6:38 am Post subject: |
|
|
ignore, change:
| Code: |
if {[regsub -all -nocase {.*ReqId:\[(.*)\].*} $arg {\1} arg]} {
|
to
| Code: |
if {[regsub -all -nocase {.*again\?\s+ReqId:\[(.*)\].*} $arg {\1} arg]} {
|
'sleep'
http://tmml.sourceforge.net/doc/tcl/after.html
or try something with TCL timers
cheers |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Feb 16, 2010 6:53 am Post subject: |
|
|
Send the message after two seconds.
| Code: | | utimer 2 [list puthelp "PRIVMSG $chan :ReqId echo -> $arg"] |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|