Каждую минуту проверяет есть ли новая тема на античате, если есть выводит на канал в таком виде:
[16:36:03] <Info> (как подменить порт? - http://forum.antichat.ru/showthread.php?t=142169&)
[16:43:05] <Info> (Что с почтой Вэб-точка-де? - http://forum.antichat.ru/showthread.php?t=142171&)
Сейчас этот бот живет на irc.antichat.net #cyberpunk. Настраивайте под свою ирк-сеть и пользуйтесь
Собственно вод код скрипта для eggdrop'a(попозже оптимизурую, так как есть мусор)
Разбил на три куска, ибо глючит=\\
Код:
##
## edited ReanimatoR
## RSS bot
##
## GHhost - Georgiewskiy Yuriy <bottleman@icf.bofh.ru> http://icf.bofh.ru (C) GHhost
##
## additional thx to mrBuG <mrbug@eggdrop.org.ru> and Drakon <drakon@eggdrop.org.ru> for help with egglib and for
## answers on my question (sometime stupid:) )
##
## based on rssnews.tcl by perpleXa - http://perpleXa.net | http://dev.perpleXa.net #perpleXa on QuakeNet (C) 2004
## Внимание!!! Данный скрипт требует установленную eggglib.tcl c http://www.eggdrop.org.ru/scripts/
## Changelog:
## 2004-09-08 rewriten using egglib by Shrike <shrike@eggdrop.org.ru> and mrBuG <mrbug@eggdrop.org.ru> to awoid
## blocked socket problems, added support to recoding feeds from different codepages.
## 2004-09-08 15:36:30 misc bug fixex, don't store colours in cache.
## 2004-09-17 15:55:41 added flood protections, added http user agent, added destination encoding var, fixed some
## charasters in html parse.
## 2004-09-20 11:18:41 added VIANOTICE feed flag to allow switch betwen post type - to channel or user via notice,
## added rss(defaultposttype) var to switch it globaly for feed which not have VIANOTICE flag
## set, added checks if egglib present.
## 2004-09-27 5:58:47 fixed bug with post news vian msg, fixed out of file decriptors bug.
## 2004-11-30 16:37:30 added proxy support, thx to <admin@lubimez.tomsk.ru>.
## 2005-09-15 20:46:00 translate to Russian by MMS <MMS@xaker.ru>
## 2005-09-15 20:53:02 fixed and optimized for WeNet
## 2009-09-XX optimized ONLY for forum.antichat.ru
###########################################
## Не изменять!
array unset feed
##
###########################################
###### Setup ##############################
set feed(antichat) {
URL=http://forum.antichat.ru/news.rss
DATABASE=rssnews/antichat.ru
CHANNELS=#cyberpunk
POSTNEWS=1
POSTLIMIT=1
PUBLIMIT=1
MSGLIMIT=1
ENCODINGFROM=cp1251
VIANOTICE=0
POSTLAYOUT= 4(10<news> 04- 07<link>04)
TRIGLAYOUT= 4(10<news> 04- 07<link>04)
}
set rss(encoding_to) cp1251
set rss(httptimeout) 150
set rss(defaultposttype) 0
set rss(client) {Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3}
set rss(use_proxy) 0
set rss(proxy_host) ""
set rss(proxy_port) 8080
###### End of Setup #######################
###########################################
Код:
# Debug mode (to display status messages on the partyline, better don't touch those lines)
set rss(debug) 1
set rss(v_major) 3
set rss(v_minor) 0
set rss(v_build) 005
if { ![info exists egglib(ver)] } {
putlog "***********************************************"
putlog " egglib_pub NOT FOUND !"
putlog " Download last version of egglib_pub here:"
putlog " http://eggdrop.org.ru/scripts/egglib_pub.zip"
putlog "***********************************************"
die
}
if { [expr {$egglib(ver) < 1.4}] } {
putlog "***********************************************"
putlog " YOUR VERSION OF egglib_pub IS TOO OLD !"
putlog " Download last version of egglib_pub here:"
putlog " http://eggdrop.org.ru/scripts/egglib_pub.zip"
putlog "***********************************************"
putlog " version installed : $egglib(ver)"
putlog " version required: 1.4"
die
}
# Binds
bind PUB -|- {last} rsspublic
bind MSG -|- {--news} rssprivate
bind TIME -|- {?? * * * *} rsscheck
bind PUB -|- {-cache} rsscheck
proc rsscheck {min hour day week year} {
global feed rssnews rss
foreach id [array names feed] {
set url "0"
set database "0"
set channels "0"
set postnews "1"
set postlimit "3"
set publimit "3"
set msglimit "5"
set postlayout "<news> <link>"
set colour ""
foreach item [split $feed($id) \n] {
regsub -all -- {/\*.*\*/} $item {} item
regexp -nocase -- {^\s*URL=(.+?)\s*$} $item tmp url
regexp -nocase -- {^\s*DATABASE=(.+?)\s*$} $item tmp database
regexp -nocase -- {^\s*CHANNELS=(.+?)\s*$} $item tmp channels
regexp -nocase -- {^\s*POSTNEWS=(.+?)\s*$} $item tmp postnews
regexp -nocase -- {^\s*POSTLIMIT=(.+?)\s*$} $item tmp postlimit
regexp -nocase -- {^\s*PUBLIMIT=(.+?)\s*$} $item tmp publimit
regexp -nocase -- {^\s*MSGLIMIT=(.+?)\s*$} $item tmp msglimit
regexp -nocase -- {^\s*ENCODINGFROM=(.+?)\s*$} $item tmp encodingfrom
regexp -nocase -- {^\s*POSTLAYOUT=(.+?)\s*$} $item tmp postlayout
regexp -nocase -- {^\s*COLOUR=(.+?)\s*$} $item tmp colour
}
if {($url == 0) || ($database == 0) || ($channels == 0)} {
putlog "RSS: Warning: Couldn't load configuration for feed '$id'"
continue
}
if {$postnews == 0} {
continue
}
#regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.*?)(\:([0-9]+))?$} $url tmp tmp host get tmp port
#if {$port == ""} {
# set port 80
#}
set latestnews "iddqd"
regexp -- {^(\S+/)?.*$} $database tmp directory
if {$directory != ""} {
if {![file isdirectory $directory]} {
file mkdir $directory
if {$rss(debug) == 1} {
putlog "RSS: created directory for feed '$id': $directory"
}
}
}
if {[file exists $database]} {
set temp [open $database r]
set latestnews [gets $temp]
if {$latestnews == ""} {
set latestnews "iddqd"
}
close $temp
}
set count 0
set data {}
set limit $postlimit
if {$limit < $publimit} {
set limit $publimit
}
if {$limit < $msglimit} {
set limit $msglimit
}
puthelp "PING :[unixtime]"
set http_id [::egglib::http_init "rsscheck_"]
::egglib::http_set_agent $http_id $rss(client)
::egglib::http_set_timeout $http_id $rss(httptimeout)
if { $rss(use_proxy) } { ::egglib::http_set_proxy $http_id $rss(proxy_host) $rss(proxy_port) }
::egglib::http_get $http_id $url[list $encodingfrom $limit $database $postlayout $postlimit $channels $id $latestnews $colour]
}
}
proc rsscheck_on_error {http_id encodingfrom limit database postlayout postlimit channels id latestnews colour} {
putlog "RSSNEWS::connect timeout while getting data for feed $id"
}