Каждую минуту проверяет есть ли новая тема на античате, если есть выводит на канал в таком виде: [16:36:03] <Info> (как подменить порт? - /showthread.php?t=142169&) [16:43:05] <Info> (Что с почтой Вэб-точка-де? - /showthread.php?t=142171&) Сейчас этот бот живет на irc.antichat.net #cyberpunk. Настраивайте под свою ирк-сеть и пользуйтесь Собственно вод код скрипта для eggdrop'a(попозже оптимизурую, так как есть мусор) Разбил на три куска, ибо глючит=\\ Code: ## ## 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=/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 ####################### ########################################### Code: # 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" } Code: proc rsscheck_on_data {http_id html encodingfrom limit database postlayout postlimit channels id latestnews colour} { global fedd rssnews rss set count 0 foreach line [split $html \n] { append data $line incr count [regexp -all -nocase -- {</item>} $line] if {([regexp -nocase -- {</rss>} $line]) || ($count >= $limit)} { break } } ::egglib::http_cleanup $http_id set temp [open $database w] set data [rsshtmlspecialchars $data] set publisher [rsspublisher $data] set data [rssparse $data] foreach {rssitem} [lsort -dictionary $data] { regsub -all -- {<id>} $postlayout $rssitem output regsub -all -- {<publisher>} $output $publisher output regsub -all -- {<news>} $output [lindex $rssnews($rssitem) 1] output regsub -all -- {<link>} $output [lindex $rssnews($rssitem) 0] output if {$encodingfrom != $rss(encoding_to)} { set output [encoding convertfrom $encodingfrom $output] set output [encoding convertto $rss(encoding_to) $output] } puts $temp $output } close $temp set count 0 set temp [open $database r] while {![eof $temp]} { gets $temp headline set line [join $headline] if {($latestnews == $headline) || ($latestnews == "iddqd") || ($line == "") || ($count == $postlimit)} { break close $temp } incr count foreach channel [channels] { set coloredline $line set colour if {[string equal -nocase $channels "ALL"]} { if {[regexp -- {c} [getchanmode $channel]]} { putserv "PRIVMSG $channel ${colour}[rssnocols $coloredline]" } else { putserv "PRIVMSG $channel ${colour}$coloredline" } } else { if {[lsearch -exact [string tolower $channels] [string tolower $channel]] != -1} { if {[regexp -- {c} [getchanmode $channel]]} { putserv "PRIVMSG $channel ${colour}[rssnocols $coloredline]" } else { putserv "PRIVMSG $channel ${colour}$coloredline" } } } } } close $temp } proc rssnews {target fid type nickname} { putlog "!rss $fid" global feed rss rssnews set url "0" set publimit "3" set msglimit "5" set triglayout "<id> <news> <link>" set vianotice $rss(defaultposttype) foreach item [split $feed($fid) \n] { regsub -all -- {/\*.*\*/} $item {} item regexp -nocase -- {^\s*URL=(.+?)\s*$} $item tmp url regexp -nocase -- {^\s*PUBLIMIT=(.+?)\s*$} $item tmp publimit regexp -nocase -- {^\s*MSGLIMIT=(.+?)\s*$} $item tmp msglimit regexp -nocase -- {^\s*TRIGLAYOUT=(.+?)\s*$} $item tmp triglayout regexp -nocase -- {^\s*ENCODINGFROM=(.+?)\s*$} $item tmp encodingfrom regexp -nocase -- {^\s*VIANOTICE=(.+?)\s*$} $item tmp vianotice } if {($url == 0)} { putserv "PRIVMSG $target :Внимание: Невозможно загрузить конфигурацию для '$id'" return 0 } #regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.*?)(\:([0-9]+))?$} $url tmp tmp host get tmp port #if {$port == ""} { #set port 80 #} if {$type == 1} { set limit $msglimit } elseif {$type == 2} { set limit $publimit } else { return 0 } set http_id [::egglib::http_init "rssnews_"] ::egglib::http_set_timeout $http_id $rss(httptimeout) ::egglib::http_set_agent $http_id $rss(client) if { $rss(use_proxy) } { ::egglib::http_set_proxy $http_id $rss(proxy_host) $rss(proxy_port) } ::egglib::http_get $http_id $url [list $target $fid $type $encodingfrom $limit $triglayout $vianotice $nickname] } proc rssnews_on_error {http_id target fid type encodingfrom limit triglayout vianotice nickname} { if {($vianotice == 0)} {putserv "PRIVMSG $target :$fid: При получении информации произошла ошибка"} if {($vianotice == 1)} {putserv "NOTICE $nickname :$fid: При получении информации произошла ошибка"} putlog "RSSNEWS::connect timeout while getting data for feed $fid" } proc rssnews_on_data {http_id html target fid type encodingfrom limit triglayout vianotice nickname} { global feed rss rssnews set count 0 foreach line [split $html \n] { append data $line incr count [regexp -all -nocase -- {</item>} $line] if {([regexp -nocase -- {</rss>} $line]) || ($count >= $limit)} { break } } ::egglib::http_cleanup $http_id set data [rsshtmlspecialchars $data] set publisher [rsspublisher $data] set data [rssparse $data] set count 0 foreach {id} [lsort -dictionary $data] { incr count regsub -all -- {<id>} $triglayout $id output regsub -all -- {<publisher>} $output $publisher output regsub -all -- {<news>} $output [lindex $rssnews($id) 1] output regsub -all -- {<link>} $output [lindex $rssnews($id) 0] output set output [join $output] if {$type == 2} { if {[regexp -- {c} [getchanmode $target]]} { set output [rssnocols $output] } } if {$encodingfrom != $rss(encoding_to)} { set output [encoding convertfrom $encodingfrom $output] set output [encoding convertto $rss(encoding_to) $output] } if {($vianotice == 0)} {putserv "PRIVMSG $target :$output"} if {($vianotice == 1)} {putserv "NOTICE $nickname :$fid:\00300$output"} if {($count == $limit)} { break } } } proc rsspublisher {content} { set publisher {n/a} regsub -all -- {\n+|\s+|\t+|\r+} $content { } content regsub -all -- {\&} $content {\\\&} content regexp -nocase -- {<title>(.+?)</title>} $content tmp publisher regsub -nocase -- {<title>(.+?)</title>} $content {} content return $publisher } proc rssparse {content} { global rssnews array unset rssnews regsub -all -- {\n+|\s+|\t+|\r+} $content { } content regsub -all -- {\&} $content {\\\&} content set item 0 while {[regexp -nocase -- {<item(\s[^>]*?)?>(.+?)</item>} $content tmp tmp value]} { incr item set title {n/a} regexp -nocase -- {<title>(.+?)</title>} $value tmp title set link {n/a} regexp -nocase -- {<link>(.+?)goto=newpost</link>} $value tmp link regsub -nocase -- {<item.*?>.+?</item>} $content {} content set rssnews($item) "{$link} {$title}" } return [array names rssnews] } proc rsshtmlspecialchars {content} { set t [string map { \x20 " \x22 ' \x27 – \x2D < \x3C > \x3E & \x26 ˜ \x7E € \x80 ¦ \xA6 © \xA9 Ä \xC4 Ö \xD6 Ü \xDC ß \xDF ä \xE4 ö \xF6 ü \xFC « \\" » \\" } $content] regsub -all -- {&\#8211;} $t {.} t return $t } proc rssprivate {nickname hostname handle arguments} { global feed rss regsub -all {\\} $arguments {\\\\} arguments set spewfeed [lindex $arguments 0] if {![isvalidfeed $spewfeed 1]} { puthelp "NOTICE $nickname :Выберите одну из доступных рассылок: [lsort -dictionary [array names feed]]" return 0 } set spewfeed [isvalidfeed $spewfeed 2] rssnews $nickname $spewfeed 1 $nickname } proc rsspublic {nickname hostname handle channel arguments} { global feed rss regsub -all {\\} $arguments {\\\\} arguments set protect 15 if {([info exists rss(flood)]) && (![isop $nickname $channel])} { set spam [expr [clock seconds] - $rss(flood)] if {$spam < $protect} { putserv "NOTICE $nickname :Скрипт в данный момент используется! Пожалуйста ждите [expr $protect - $spam] секунд." return 0 } } set rss(flood) [clock seconds] set spewfeed [lindex antichat 0] if {![isvalidfeed $spewfeed 1]} { puthelp "NOTICE $nickname :Выберите одну из доступных рассылок: [lsort -dictionary [array names feed]]" return 0 } set spewfeed [isvalidfeed $spewfeed 2] set channels 0 foreach item [split $feed($spewfeed) \n] { regsub -all -- {/\*.*\*/} $item {} item regexp -nocase -- {^\s*CHANNELS=(.+?)\s*$} $item tmp channels } if {([lsearch -exact [string tolower $channels] [string tolower $channel]] == -1) && (![string equal -nocase $channels "ALL"])} { puthelp "NOTICE $nickname :Эта рассылка недоступна на данном канале." return 0 } rssnews $channel $spewfeed 2 $nickname } proc isvalidfeed {keyword type} { global feed foreach id [array names feed] { if {[string equal -nocase $id $keyword]} { switch -exact -- $type { {1} { return 1 } {2} { return $id } } } } return 0 } proc rssnocols {string} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?} $string {} string return $string } putlog "Script loaded: RSS feed parser $rss(v_major).$rss(v_minor).$rss(v_build) (C) 2004 GHhost." putlog "RSS feed parser translated to Russian by MMS <MMS@xaker.ru , /server irc.wenet.ru #37>" putlog "Antichat's Announcements loader edited by ReanimatoR>" CHANNELS=#cyberpunk заменить на нужный вам канал.
Удобный бот с его выдачей тем, с самого начала его трудовой деятельности читаем +) Полезный скрипт +)
И чего? Да сказать, почему бы и нет. А почему Вы не пришли и не отредактировали или навели на мысль? Только ругать да умеем?
да не заходит irc.antichat.net- *** Looking up your hostname... - -irc.antichat.net- *** Couldn't resolve your hostname; using your IP address instead - -irc.antichat.net- *** You connected on 7771 port. Using CP1251 translation scheme as default. -
fox_malder, действительно "You connected" это значит не заходит... У меня всё работает, что я делаю не так? ПыСы пиши /join #antichat
школотень это ты му**к. я был на олчитсе когда ты пытался осовить экшены on text, on join и тд в мирке, "писал" бота, который будет тебе опа давать на канале, весь день и тупые вопросы задавал, что ты там отредактировать можешь? не смеши.
и?) научился же, а ты как был школотроллем так и остался p.s. почитал твои посты... удачи в игноре тебе, все равно ничего умного не скажешь на этом форуме...