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.
Old posts that have not been replied to for several years.
E
EbOoZ
Post
by EbOoZ » Fri Nov 19, 2004 10:20 am
Hello people,
I'm trying to set up my own IRC bot. Usually that's no problem but currently I've some problems with my own script.
I would like to set up the bot so it will post a title and a link of new news posts on my website to IRC.
I'm using this RSS Feed:
http://www.ebooz.nl/rss.php
and this TCL script:
http://www.ebooz.nl/ebooz_tcl.txt (on my server with the tcl extension ofcourse).
The main problem I have is that the bot isn't displaying more than one headline when someone uses a trigger. Even if I set "ebooz(headlines)" to 3.
I don't get any errors in the console of the eggdrop.
Can somebody help me with this problem? Thanks in advance
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Fri Nov 19, 2004 11:03 am
in your xml you have "</item><item>" and you do:
if {[regexp "<item>" $line]} { set item 1 }
if {[regexp "</item>" $line]} { set item 0 }
Either add a linebreak between the closing/opening item tags in the xml or do the closing check first in your tcl.
...or you could avoid the whole problem by doing the loop like this instead:
Code: Select all
foreach item [regexp -all -inline {<item.*?</item>} $data] {
if {[string match "*<title>*</title>*<link>*</link>*" $item]} {
# valid item - extract title + link and incr your counter
}
}
Have you ever read "The Manual"?
E
EbOoZ
Post
by EbOoZ » Mon Nov 22, 2004 3:45 am
Correct me if i'm wrong, but the loop resulted in no reply of the bot.
I've changed this code:
Code: Select all
foreach line [split $data \n] {
regsub -all "\\&" $line "\\\\&" line
if {[regexp "<item>" $line]} { set item 1 }
if {[regexp "</item>" $line]} { set item 0 }
if {$item == 1} {
regexp "<title>(.*)</title>" $line trash eboozdata(titel,$count)
if {[regexp "<link>(.*)</link>" $line trash eboozdata(link,$count)]} { incr count }
}
}
Into this:
Code: Select all
foreach item [regexp -all -inline {<item.*?</item>} $data] {
if {[string match "*<title>*</title>*<link>*</link>*" $item]} {
# valid item - extract title + link and incr your counter
}
}
The bot sees the trigger, but isn't displaying anything on the channel. Also when I do first the closing check it has the same problem.
Any other suggestions?
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Mon Nov 22, 2004 5:17 am
well... user's code wasn't meant to show anything - it was just an example on how to do it yourself
# valid item - extract title + link and incr your counter
you should read what you are supposed to do
E
EbOoZ
Post
by EbOoZ » Mon Nov 22, 2004 7:07 am
Hehe, you should have noticed that I'm a newb when it's about TCL scripting.
Ah well, I will try some things to make it work!
You will probably hear from me
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Tue Nov 23, 2004 11:37 am
EbOoZ wrote: Hehe, you should have noticed that I'm a newb when it's about TCL scripting.
yes... but i didn't notice that you are a newb when it's about reading as well
E
EbOoZ
Post
by EbOoZ » Wed Nov 24, 2004 12:02 pm
arcane wrote: EbOoZ wrote: Hehe, you should have noticed that I'm a newb when it's about TCL scripting.
yes... but i didn't notice that you are a newb when it's about reading as well
oops!
However... I've changed several things but everything is resulting in errors. If you know the solution to my problem, can you please give it to me?
Greetz
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Wed Nov 24, 2004 12:26 pm
You wrote the script, but fail to make minor changes to it?
Something smells fishy...
Have you ever read "The Manual"?
E
EbOoZ
Post
by EbOoZ » Wed Nov 24, 2004 4:55 pm
I did not wrote the script, but I editted it to use it with my own rss feed.