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.

Bot is not showing more than one headline

Old posts that have not been replied to for several years.
Locked
E
EbOoZ

Bot is not showing more than one headline

Post by EbOoZ »

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 avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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. :wink:
...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 »

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?
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

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 :)
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
E
EbOoZ

Post by EbOoZ »

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 :wink:
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

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 :mrgreen:
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
E
EbOoZ

Post by EbOoZ »

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 :mrgreen:
:oops: 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 avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Weird

Post by user »

You wrote the script, but fail to make minor changes to it? :o
Something smells fishy...
Have you ever read "The Manual"?
E
EbOoZ

Post by EbOoZ »

I did not wrote the script, but I editted it to use it with my own rss feed.
Locked