mIRC Homepage

(Twitch) Last message of a user

Posted By: Bestpeff

(Twitch) Last message of a user - 03/05/16 12:57 PM

If my mIRC bot is inside a twitch chat, but I'm not physically there, is there a script like !last (user) then it'll say "(user) last message was: "blah" (time ago) so on. Is that a possible script? And I have my bot under my main twitch account and is connect to multiple twitch chat.
Posted By: Sakana

Re: (Twitch) Last message of a user - 03/05/16 02:22 PM

Try this

Code:
;Seen script, pretty much self-explanatory.
;Syntax:
;/seen on/off
;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] 
;Just add any words you don't want to be used.
;/msg #channel/bot !seen name
;* 
; Ollie

alias seen {
  if ($1 == del) && ($2) {
    if (!$read(funny.txt, w, $2)) { echo -a Error: $+(",$2,") is not in the database. | return }
    write -dw $+ $2 funny.txt
    echo -a Removed: $+(",$2,",.) From the 'funny' words list.
    return
  }
  if ($1 == add) && ($2) {
    if ($read(funny.txt, w, $2)) { echo -a Error: $+(",$2,") is already in the database. | return }
    write funny.txt $2
    echo -a Added: $+(",$2,",.) To the 'funny' words list.
    return
  }
  if ($1 == on) {
    echo -a Seen Status: On
    set %seen on
    return
   }
  if ($1 == off) {
    echo -a Seen Status: Off
    set %seen off
    return
  }
  echo -a Unknown parameter.
}
on *:text:!seen*:*:{
  if (%seen == off) { return }
  var %target = $iif($chan,$chan,$nick)
  if (!$2) { notice $nick seen whom? | return }
  if ($2 == $nick) { 
    describe %target hands $nick a mirror. 
    return 
  }
  if ($chan) && ($2 ison $chan) { 
    msg %target $2 Is in the channel! $iif(%last.spoke. [ $+ [ $2 ] ],His/her last words were: %last.spoke. [ $+ [ $2 ] ],They haven't spoken anything yet!) 
    return 
  }
  if (!%seen. [ $+ [ $2 ] ] ) { 
    if ($read(funny.txt, w, $2)) { 
      msg %target hoho. aren't you a funny one 
      halt 
    } 
    if (!%seen. [ $+ [ $2 ] ] ) { 
      msg %target i have never seen $2 | return 
    }
  }
  if (%seen. [ $+ [ $2 ] ] ) { 
    msg %target I last saw $2 %seen. [ $+ [ $2 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $2 ] ] )) ago. $iif(%last.spoke. [ $+ [ $2 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $2 ] ],He left without saying anything!)
  }
}

on *:NICK:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick
  set %seen.last. [ $+ [ $nick ] ] $ctime
}

on *:kick:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick 
  set %seen.last. [ $+ [ $knick ] ] $ctime
}

on *:JOIN:#:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}

on *:text:*:#:{
  if (%seen == off) { return }
  set %last.spoke. [ $+ [ $nick ] ] $1-
}

on *:quit:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}

on *:part:#:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Parting at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}
Posted By: Bestpeff

Re: (Twitch) Last message of a user - 05/05/16 01:34 PM

Originally Posted By: Sakana
Try this

Code:
;Seen script, pretty much self-explanatory.
;Syntax:
;/seen on/off
;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] 
;Just add any words you don't want to be used.
;/msg #channel/bot !seen name
;* 
; Ollie

alias seen {
  if ($1 == del) && ($2) {
    if (!$read(funny.txt, w, $2)) { echo -a Error: $+(",$2,") is not in the database. | return }
    write -dw $+ $2 funny.txt
    echo -a Removed: $+(",$2,",.) From the 'funny' words list.
    return
  }
  if ($1 == add) && ($2) {
    if ($read(funny.txt, w, $2)) { echo -a Error: $+(",$2,") is already in the database. | return }
    write funny.txt $2
    echo -a Added: $+(",$2,",.) To the 'funny' words list.
    return
  }
  if ($1 == on) {
    echo -a Seen Status: On
    set %seen on
    return
   }
  if ($1 == off) {
    echo -a Seen Status: Off
    set %seen off
    return
  }
  echo -a Unknown parameter.
}
on *:text:!seen*:*:{
  if (%seen == off) { return }
  var %target = $iif($chan,$chan,$nick)
  if (!$2) { notice $nick seen whom? | return }
  if ($2 == $nick) { 
    describe %target hands $nick a mirror. 
    return 
  }
  if ($chan) && ($2 ison $chan) { 
    msg %target $2 Is in the channel! $iif(%last.spoke. [ $+ [ $2 ] ],His/her last words were: %last.spoke. [ $+ [ $2 ] ],They haven't spoken anything yet!) 
    return 
  }
  if (!%seen. [ $+ [ $2 ] ] ) { 
    if ($read(funny.txt, w, $2)) { 
      msg %target hoho. aren't you a funny one 
      halt 
    } 
    if (!%seen. [ $+ [ $2 ] ] ) { 
      msg %target i have never seen $2 | return 
    }
  }
  if (%seen. [ $+ [ $2 ] ] ) { 
    msg %target I last saw $2 %seen. [ $+ [ $2 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $2 ] ] )) ago. $iif(%last.spoke. [ $+ [ $2 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $2 ] ],He left without saying anything!)
  }
}

on *:NICK:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick
  set %seen.last. [ $+ [ $nick ] ] $ctime
}

on *:kick:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick 
  set %seen.last. [ $+ [ $knick ] ] $ctime
}

on *:JOIN:#:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}

on *:text:*:#:{
  if (%seen == off) { return }
  set %last.spoke. [ $+ [ $nick ] ] $1-
}

on *:quit:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}

on *:part:#:{
  if (%seen == off) { return }
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Parting at $fulldate 
  set %seen.last. [ $+ [ $nick ] ] $ctime 
}


It works great, but one problem is, whenever I !seen (user) it always comes up with the message "Invalid request" Is there a fix to that?
Posted By: Bestpeff

Re: (Twitch) Last message of a user - 08/05/16 07:57 AM

Scratch that last reply off, but how do I get it so I am the only one that can use the command? Where do I place the If ($nick==Bestpeff) ? And the script works perfect I love it!
© 2022 mIRC Discussion Forums