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.

Finding out when a topic was set

Old posts that have not been replied to for several years.
Locked
S
Sho

Finding out when a topic was set

Post by Sho »

Hi!

My objective is the following: I want to create a partyline command ".foo #channel" that returns the timestamp of when the topic on the channel was set to the partyline.

I have a *rough* understanding of how to do this: I have to bind a partyline command that, when it is issued, binds the raw numerical 333, issues a topic command, catches the raw server reply, scans it for the unixtime field in the reply and puts it on the partyline via putlog.

Now, I'm a total TCL beginner, and while I think I understand what I have to do here on a conceptual level, I will never ever get the syntax right. Can anybody help me?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well that is not that difficult. Try implementing the script and let us know if you recieve any errors.

You might have some difficultly with the raw proc and splitting the text other than that it would be fairly easy.

You can save the unixtime in notes, make the bot send a note to you, or memo you if you have MemoServices or you could write it to a file and make public trigger to retrieve it.

Just remember the raw 333, will only trigger when a topic is changed. So you cannot make it trigger before that. You cannot bind dcc to trigger a raw on 333. Just bind raw 333 and make a proc to trigger it get the unixtime and save it as I said.

Then make a public trigger to retrieve the unixtime.

Question:
What will you do if you want the bot to retrieve the time when the topic was set, when it joins the channel? How about thinking about that too. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Something like this should do the trick

Code: Select all

bind raw - "331" reply:notopic
bind raw - "333" reply:topicwhotime

bind dcc -|- foo dcc:gettopic
proc dcc:gettopic {hand idx arg} {
 global topic
  set chan [lindex [split $arg] 0]
  if {$chan == ""} {
    putdcc $idx "Syntax: .foo <#channel>"
    return
  }
  if {[catch {botonchan $chan}]} {
    putdcc $idx "I'm not on $chan!"
    return
  }
  set topic(idx) $idx
  putserv "TOPIC $chan"
}

proc reply:notopic {from key args} {
 global topic
  putdcc $topic(idx) "No topic is set."
}

proc reply:topicwhotime {from key args} {
 global topic
  set when [lindex [join $args] end]
  putdcc $topic(idx) "Topic was set: [ctime $when] ([duration [expr [clock seconds]-$when]] ago)"
}
S
Sho

Post by Sho »

First off, thanks to both to you. :)

gb, thanks! Works great.

I'll promise I'll analyse that code, so I get what's going on ;).
Locked