Quiz Memorial Forum

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> last.tcl - cкрипт вывода сообщений из логов
upper
post Apr 10 2008, 10:42 AM
Post #1


Посетитель
*

Group: Members
Posts: 3
Joined: 10-April 08
Member No.: 209



Есть очень хороший скрипт вывода последних сообщений в канал
как бы переделать его чтоб показывал сообщения на дату и с заданного времени?
например на команду с канала #nnm

!чтобылото 01.04.2008 14:05

выводил из файла вида #nnm.log.01Apr2008

строчки вида

[14:05] #nnm: mode change '+v noid51622' by Botter!~Botter@[IrcCity]-1AF3F673.bsys-net.ru
[14:05] <noid51622> ntcn. ntcn. njkmrj yt rbrfqnt
[14:05] noid51622 kicked from #nnm by Botter: Пипипип, пипипип - мой сигналит жип, мой сигналит жип
[14:05] noid51622 (~piespy@[IrcCity]-1AF3F673.bsys-net.ru) joined #nnm.
[14:05] <_Master-> 6.31
[14:05] #nnm: mode change '+v noid51622' by Botter!~Botter@[IrcCity]-1AF3F673.bsys-net.ru
[14:08] <Klut> ку
[14:08] #nnm: mode change '+o Klut' by Botter!~Botter@[IrcCity]-1AF3F673.bsys-net.ru
[14:08] #nnm: mode change '-v Klut' by Klut![email protected]
[14:08] #nnm: mode change '-o Klut' by Klut![email protected]
[14:08] <Klut> re
[14:09] <Klut> pltcm tcnm rnj ;bdjq

вот код скрипта который по идее можно переделать, я не знаю с какого конца подойти только

CODE


bind pub - !чтобылото last:pub
bind pub - !wtf last:pub

#set utime "[ctime [unixtime]]"
#   set time [lindex $utime 3]

set last(n) 30

proc putfast {text} {
append text "\n"
putdccraw 0 [string length $text] $text
}


set last(timer) [timer 1 last:createlogs]

proc last:createlogs {} {
global last

foreach chan [channels] {

set last_logfile [logfile jkp $chan /eggdrop/logs/$chan.log]
putlog "Loging $chan in file $last_logfile"

}

catch { killtimer $last(timer) }

}

proc last:pub { nick mask hand chan text } {

putlog "ищу на $chan файл $chan.log.[clock format [unixtime] -format %d%b%Y]"

if {[file exists /eggdrop/logs/$chan.log.[clock format [unixtime] -format %d%b%Y]]} {

putlog "вывожу на $chan из $chan.log.[clock format [unixtime] -format %d%b%Y]"

set file [open "/eggdrop/logs/$chan.log.[clock format [unixtime] -format %d%b%Y]" "r"]
set last_num 0  
while {![eof $file]} {
  set str [gets $file line ]
  if {$str != ""} {
   incr last_num +1
   set last_log($last_num) $line
     }

  }
close $file


putlog "$nick called last on $chan"

global last

set i $last_num
incr i "-$last(n)"
if {($i<1)} {
set i 1
}

while {($last_num>$i)} {
putfast "PRIVMSG $nick : $last_log($i)"
incr i;
}
}

}
putlog "!last by Humanoid loaded";
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Kreon
post Apr 10 2008, 02:23 PM
Post #2


Developer
******

Group: Root Admin
Posts: 396
Joined: --
From: Внешние пределы
Member No.: 2



В общем-то интересная задача. И главное относительно непростая. %)
Попытался что-то наваять на тему. Попробуйте.

ЗЫ: В следующий раз прикладывайте файлы в аттачи, а не копируйте исходники целиком в теги CODE.
ЗЗЫ: Я бы сказал, что приведенный вами скрипт "очень хороший" разве что в кавычках.


Attached File(s)
Attached File  last.tcl ( 4.88k ) Number of downloads: 865


--------------------
Не понял сам - не дай понять другому
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
upper
post Apr 11 2008, 10:52 AM
Post #3


Посетитель
*

Group: Members
Posts: 3
Joined: 10-April 08
Member No.: 209



Спасибо,
получилось просто супер !!!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 28th March 2024 - 02:10 PM
Design by GPF © 2006