egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help to add/post date

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Black|Man
Voice


Joined: 25 Oct 2002
Posts: 21
Location: Denmark

PostPosted: Tue Sep 16, 2003 6:42 am    Post subject: Help to add/post date Reply with quote

how to set from nickname to Date
that post this -> News by nick:
and this i need -> News 16/09-2003:

Code:

# add news

proc nws:addnews {nick uhost handle chan arg} {
    global nws
    if {$chan != $nws(chan)} {return 0}
    set file $nws(file) ; set arg [mirc_strip "$nick $arg"]
    set nws(fd) [open $file a+]
    puts $nws(fd) $arg
    close $nws(fd)
    putserv "NOTICE $nick :News has been added"
    putcmdlog "<<$nick>> !$handle! Added news in $chan."
    return 1
}

# read news
proc nws:news {nick uhost handle chan arg} {
    global nws
    if {$chan != $nws(chan)} {return 0}
    set file $nws(file)
    if {![file exists $file]} {putserv "NOTICE $nick :No news found, $file does not exist" ; return}
    set nws(fd) [open $file r]
    set nws(list) ""
    while { ![eof $nws(fd)] } {
     set tmp [gets $nws(fd)]
     if { $tmp != ""} {lappend nws(list) $tmp }
    }
    close $nws(fd)
    if {[llength $nws(list)] == 0} {putserv "NOTICE $nick :No news found, $file is empty"; return}
    set arg [split $arg]
    if {$arg=="" || ![string is integer $arg]} {
       putserv "NOTICE $nick :[exec grep -c "" $file] news items:"
       foreach news $nws(list) {
    set place [expr [lsearch -exact $nws(list) $news] + 1]
    set name [lindex [split $news] 0]
    set comments [expr [llength [split $news |]] - 1]
         putserv "NOTICE $nick :$place.\002 [lrange [split $news] 1 4]...\002 ($comments comments)"
       }
    } else {
       if {$arg > [llength $nws(list)] || $arg <= 0} {return}
       set news [split [lindex [split [lindex $nws(list) [expr $arg - 1]] |] 0]]
       set cmnt [lrange [split [lindex $nws(list) [expr $arg - 1]] |] 1 end]
       putserv "NOTICE $nick :\002News\002 by \002[lindex $news 0]\002: [lrange $news 1 end]"
       foreach line $cmnt {
          putserv "NOTICE $nick :\002Comment\002 by \002[lindex [split $line] 1]\002: [lrange [split $line] 2 end]"
       }
    }
}
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber