Away System V2.0

By eNkIL on Sep 15, 2018

Away System V 2.0

::::::::::::::::::::::::::::
:::::: Coded By eNkIL ::::::
::::::::::::::::::::::::::::
::: Cambiale si sabes =) :::
::::::::::::::::::::::::::::

;Away System

on *:load: { 
  set %tipo.spam ame
  set %tiempo.aaway 10
  set %nick.away Away-Nick
  set %anuncio.away 15
  set %auto.away 600
  set %a.spam.away 900
  set %msg.awayon.st Away On: [m] - Salida: [h]
  set %msg.away.st Away: [m] - Fuera desde las: [h] - Tiempo Fuera: [t]
  set %msg.awayoff.st Away Off: [m] - Tiempo Ausente: [t] - Fuera desde las: [h]
  echo -at [( Away System )] By eNkIL
}
menu menubar,channel,status { 
  Away System:awaysys
  -
}
; Aliases
alias awaysys {
  if ($dialog(awaysys) == $null) { noop $dialog(awaysys,awaysys,-2) } 
  else { .echo -at -Dialogo de Away Ejecutandose.. } 
}
alias away.dur { 
  dialog -t awaysys Away System - $iif($away,Ausente: $duration($awaytime),En Linea) 
}
alias durationasaway { 
  %tipo.spam $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime))
}
alias set.away {
  set %awayon 1
  if (%autoaway.on == on) { set %razona Autoaway Por Inactividad | .timercheck.aaway off }
  else { set %razona $did($dname,101).text }
  if (%razona == $null) { set %razona Sin Razon } 
  if (%act.cam.nick) { set %nick.back $me | nick %nick.away }
  if (%act.anun.nick) {
    set %a.spam.away $calc(%anuncio.away * 60)
    set %awaysal $time(hh:nnt)
    .timerasaway 0 %a.spam.away durationasaway
    %tipo.spam $replace(%msg.awayon.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal)
  }
  if (%page) { 
    window -g2k0 +l @AwayMsg 0 0 900 450 @AwayMsg 
    wa.log  -----------------------------------------------------------------
    wa.log  *** Sesión comenzada %awaysal
    wa.log  *** Razón de away: %razona
    wa.log  -----------------------------------------------------------------
  }
  away %razona
}
alias wa.log {
  echo -t @awaymsg $1-
}
alias set.back {
  if (%page) { 
    wa.log  -----------------------------------------------------------------
    wa.log  *** Sesión finalizada $asctime(hh:nnt)
    wa.log  -----------------------------------------------------------------
  }
  if (%act.anun.nick) { %tipo.spam $replace(%msg.awayoff.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) }
  if (%act.cam.nick) { set %nick.away $me | nick %nick.back }
  if (%act.auto.away) { set %autoaway.on off | .timercheck.aaway 0 30 autoawaycheck }
  .timerasaway off
  set %awayon 0
  unset %razona 
  away
}
alias info.away {
  if (%act.auto.away) { did -c $dname 201 | did -e $dname 202 | did -ra $dname 202 %tiempo.aaway | .enable #autoaway  }
  else { did -u $dname 201 | did -b $dname 202 | did -ra $dname 202 %tiempo.aaway | .disable #autoaway }
  if (%act.cam.nick) { did -c $dname 203 | did -e $dname 204 | did -ra $dname 204 %nick.away }
  else { did -u $dname 203 | did -b $dname 204 | did -ra $dname 204 %nick.away }
  if (%act.anun.nick) { did -c $dname 205 | did -e $dname 206 | did -ra $dname 206 %anuncio.away }
  else { did -u $dname 205 | did -b $dname 206 | did -ra $dname 206 %anuncio.away }
  if (%act.auto.resp) { did -c $dname 207 }
  else { did -u $dname 207 }
  if (%page) { did -c $dname 209 }
  else { did -u $dname 209 }
  if (%tipo.spam == ame) { did -c $dname 212 | did -u $dname 213 }
  elseif (%tipo.spam == amsg) { did -u $dname 212 | did -c $dname 213 }
  did -ra $dname 403 %msg.awayon.st
  did -ra $dname 405 %msg.away.st
  did -ra $dname 407 %msg.awayoff.st
}
alias update.away { 
  if (%awayon) { did -b $dname 101,201-207,209,211,212,213,403,405,407,408 | did -r $dname 101 | did -ve $dname 303 | did -bh $dname 302 }
  else { did -r $dname 101 | did -a $dname 101 No Estoy!. | did -a $dname 101 Vuelvo en un momento. | did -a $dname 101 Viendo tele. | did -a $dname 101 Ahora no puedo contestar. | did -ve $dname 302 | did -bh $dname 303 | did -e $dname 101,201,203,205,207,209,211,212,213,403,405,407,408 | info.away }
} 
#autoaway off
alias autoawaycheck { 
  if ($idle > %auto.away) {
    if ($away == $true) { halt }
    else {
      set %autoaway.on on
      set.away
    }
  }
}
#autoaway end
on *:CONNECT:{  
  if (%act.auto.away = 1) { .timercheck.aaway 0 30 autoawaycheck }
}
on 1:TEXT:*:#:{ 
  if ($me isin $strip($1-))  { 
    if ($away == $true) {
      if (%page) { wa.log .: Info :: $timestamp :: $chan :: $nick $+ : $1- }
      if (%act.auto.resp) { 
        if (%away.cont. [ $+ [ $nick ] ] == $null) { .notice $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - Unico mensaje. }
        set -u180 %away.cont. [ $+ [ $nick ] ] - 
      }
    }
    halt
  }
}
on 1:TEXT:*:?:{
  if ($away == $true) {
    if (%page) { wa.log .: Info :: $timestamp :: PM :: $nick $+ : $1- }
    if (%act.auto.resp) { 
      if (%away.cont. [ $+ [ $nick ] ] == $null) { .msg $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - Unico mensaje. }
      set -u180 %away.cont. [ $+ [ $nick ] ] - 
    }
  }
  halt
}
on 1:ACTION:*:?: {
  if ($away == $true) {
    if (%page) { wa.log .: Info :: $timestamp :: PMA :: $nick $+ : $1- }
    if (%act.auto.resp) { 
      if (%away.cont. [ $+ [ $nick ] ] == $null) { .msg $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - Unico mensaje. }
      set -u180 %away.cont. [ $+ [ $nick ] ] - 
    }
  }
  halt
}

on 1:ACTION:*:#:{ 
  if ($me isin $strip($1-))  { 
    if ($away == $true) {
      if (%page) { wa.log .: Info :: $timestamp :: $chan :: $nick $+ : $1- }
      if (%act.auto.resp) { 
        if (%away.cont. [ $+ [ $nick ] ] == $null) { .notice $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - Unico mensaje. }
        set -u180 %away.cont. [ $+ [ $nick ] ] - 
      }
    }
    halt
  }
}
on *:op:#: { 
  if ($away) && ($opnick == $me) { 
    if (%page) { wa.log .: Op :: $timestamp :: $chan :: $nick $+ : $1- }
  }
}
on *:deop:#: { 
  if ($away) && ($opnick == $me) { 
    if (%page) { wa.log .: Deop :: $timestamp :: $chan :: $nick $+ : $1- }
  }
}
on *:kick:#: { 
  if ($away) && ($knick == $me) { 
    if (%page) { wa.log .: Kick :: $timestamp :: $chan :: $nick $+ : $1- }
  }
}
on *:ban:#: { 
  if ($away) && ($banmask iswm $address($me,5)) { 
    if (%page) { wa.log .: Ban :: $timestamp :: $chan :: $nick $+ : $1- }
  }
}
on *:Disconnect: {
  set %awayon 0
  .timercheck.aaway off
}

; Dialogo principal
dialog awaysys {
  title "Away System"
  size -1 -1 138 35 
  option dbu
  box "Razon Away", 100, 1 1 136 33 
  combo 101, 3 9 132 10, drop edit sort
  ;
  box "Configuraciones", 200, 1 35 97 50
  check "Act. Autoaway      Mins:", 201, 5 42 65 10
  edit "", 202, 75 42 20 9, center
  check "Cambio de nick:", 203, 5 52 45 10
  edit "", 204, 55 52 40 9, center
  check "Anunciar away cada:", 205, 5 62 65 10
  edit "", 206, 75 62 20 9, center
  check "Auto Respuesta en Away", 207, 5 72 70 10
  box "Away-Log", 208, 99 35 37 25
  check "On", 209, 108 45 20 9 
  box "Tipo Spam", 211, 99 60 37 25
  radio "/ame", 212, 108 67 20 9 
  radio "/amsg", 213, 108 75 22 9
  ;
  button "▼", 301, 116 20 20 10
  button "Poner Away", 302, 2 20 35 10 
  button "Quitar Away", 303, 2 20 35 10, hide
  button "Cerrar", 304, 40 20 35 10, cancel
  ;
  box "Mensajes de Away", 401, 1 85 135 110
  text "Salida Away:", 402, 3 93 40 10
  edit "", 403, 2 102 133 10, autohs
  text "En Away:", 404, 3 113 40 10
  edit "", 405, 2 122 133 10, autohs
  text "Regreso Away:", 406, 3 133 40 10
  edit "", 407, 2 142 133 10, autohs
  button "Aplicar", 408, 43 183 55 10
  text [b] - Negrita $+ $crlf $+ [u] - Subrayado $+ $crlf $+ [k] - Color, 409, 2 155 90 25, left
  text Mensaje de Away - [m] $+ $crlf $+ Tiempo Regreso - [t] $+ $crlf $+ Hora de salida - [h], 410, 45 155 90 25, right
}
;Eventos dialogo
on *:dialog:awaysys:*:*:{ 
  if ($devent == init) { 
    if ($did = 0) { info.away | update.away | away.dur | .timerdiaawadur 0 1 away.dur }
  }
  ;
  if ($devent == sclick) { 
    if ($did = 201) { set %act.auto.away $did($dname,201).state | update.away | if (%act.auto.away = 1) { .timercheck.aaway 0 30 autoawaycheck } | else { .timercheck.aaway off } }
    if ($did = 203) { set %act.cam.nick  $did($dname,203).state | update.away }
    if ($did = 205) { set %act.anun.nick $did($dname,205).state | update.away }
    if ($did = 207) { set %act.auto.resp $did($dname,207).state | update.away }
    if ($did = 209) { set %page $did($dname,209).state }
    if ($did = 212) { set %tipo.spam ame }
    if ($did = 213) { set %tipo.spam amsg }
    if ($did = 301) { if ($did(301) == ▼) { dialog -s $dname -1 -1 276 392 | did -ra $dname 301 ▲ } | else { dialog -s $dname -1 -1 276 70 | did -ra $dname 301 ▼ } }
    if ($did = 302) { set.away | update.away } 
    if ($did = 303) { set.back | update.away }
    if ($did = 408) { set %msg.awayon.st $did($dname,403) | set %msg.away.st $did($dname,405) | set %msg.awayoff.st $did($dname,407) } 
  }
  ;
  if ($devent == edit) {
    if ($did = 202) { set %tiempo.aaway $did($dname,202) | set %auto.away $calc(%tiempo.aaway * 60) }
    if ($did = 204) { set %nick.away    $did($dname,204) }
    if ($did = 206) { set %anuncio.away $did($dname,206) }
  }
  if ($devent == close) { .timerdiaawadur off }
}
::::::::::::::::::::::::::::
:::::: Coded By eNkIL ::::::
::::::::::::::::::::::::::::
::: Cambiale si sabes =) :::
::::::::::::::::::::::::::::

;Away System English

on *:load: { 
  set %tipo.spam ame
  set %tiempo.aaway 10
  set %nick.away Away-Nick
  set %anuncio.away 15
  set %auto.away 600
  set %a.spam.away 900
  set %msg.awayon.st Away On: [m] - Out at: [h]
  set %msg.away.st Away: [m] - Away from: [h] - Time out: [t]
  set %msg.awayoff.st Away Off: [m] - Away since: [t] - Away hour: [h]
  echo -at [( Away System )] By eNkIL
}
menu menubar,channel,status { 
  Away System:awaysys
  -
}
; Aliases
alias awaysys {
  if ($dialog(awaysys) == $null) { noop $dialog(awaysys,awaysys,-2) } 
  else { .echo -at - Away System Dialog Opened.. } 
}
alias away.dur { 
  dialog -t awaysys Away System - $iif($away,Away: $duration($awaytime),Online) 
}
alias durationasaway { 
  %tipo.spam $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime))
}
alias set.away {
  set %awayon 1
  if (%autoaway.on == on) { set %razona Auto Away | .timercheck.aaway off }
  else { set %razona $did($dname,101).text }
  if (%razona == $null) { set %razona No Reason... } 
  if (%act.cam.nick) { set %nick.back $me | nick %nick.away }
  if (%act.anun.nick) {
    set %a.spam.away $calc(%anuncio.away * 60)
    set %awaysal $time(hh:nnt)
    .timerasaway 0 %a.spam.away durationasaway
    %tipo.spam $replace(%msg.awayon.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal)
  }
  if (%page) { 
    window -g2k0 +l @AwayMsg 0 0 900 450 @AwayMsg 
    wa.log  -----------------------------------------------------------------
    wa.log  *** Started at: %awaysal
    wa.log  *** Away Reason: %razona
    wa.log  -----------------------------------------------------------------
  }
  away %razona
}
alias wa.log {
  echo -t @awaymsg $1-
}
alias set.back {
  if (%page) { 
    wa.log  -----------------------------------------------------------------
    wa.log  *** Away Off: $asctime(hh:nnt)
    wa.log  -----------------------------------------------------------------
  }
  if (%act.anun.nick) { %tipo.spam $replace(%msg.awayoff.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) }
  if (%act.cam.nick) { set %nick.away $me | nick %nick.back }
  if (%act.auto.away) { set %autoaway.on off | .timercheck.aaway 0 30 autoawaycheck }
  .timerasaway off
  set %awayon 0
  unset %razona 
  away
}
alias info.away {
  if (%act.auto.away) { did -c $dname 201 | did -e $dname 202 | did -ra $dname 202 %tiempo.aaway | .enable #autoaway  }
  else { did -u $dname 201 | did -b $dname 202 | did -ra $dname 202 %tiempo.aaway | .disable #autoaway }
  if (%act.cam.nick) { did -c $dname 203 | did -e $dname 204 | did -ra $dname 204 %nick.away }
  else { did -u $dname 203 | did -b $dname 204 | did -ra $dname 204 %nick.away }
  if (%act.anun.nick) { did -c $dname 205 | did -e $dname 206 | did -ra $dname 206 %anuncio.away }
  else { did -u $dname 205 | did -b $dname 206 | did -ra $dname 206 %anuncio.away }
  if (%act.auto.resp) { did -c $dname 207 }
  else { did -u $dname 207 }
  if (%page) { did -c $dname 209 }
  else { did -u $dname 209 }
  if (%tipo.spam == ame) { did -c $dname 212 | did -u $dname 213 }
  elseif (%tipo.spam == amsg) { did -u $dname 212 | did -c $dname 213 }
  did -ra $dname 403 %msg.awayon.st
  did -ra $dname 405 %msg.away.st
  did -ra $dname 407 %msg.awayoff.st
}
alias update.away { 
  if (%awayon) { did -b $dname 101,201-207,209,211,212,213,403,405,407,408 | did -r $dname 101 | did -ve $dname 303 | did -bh $dname 302 }
  else { did -r $dname 101 | did -a $dname 101 Not Here!. | did -a $dname 101 BRB. | did -a $dname 101 Watching tv. | did -a $dname 101 Can't talk. | did -ve $dname 302 | did -bh $dname 303 | did -e $dname 101,201,203,205,207,209,211,212,213,403,405,407,408 | info.away }
} 
#autoaway off
alias autoawaycheck { 
  if ($idle > %auto.away) {
    if ($away == $true) { halt }
    else {
      set %autoaway.on on
      set.away
    }
  }
}
#autoaway end
on *:CONNECT:{  
  if (%act.auto.away = 1) { .timercheck.aaway 0 30 autoawaycheck }
}
on 1:TEXT:*:#:{ 
  if ($me isin $strip($1-))  { 
    if ($away == $true) {
      if (%page) { wa.log .: Info :: $chan :: $nick $+ : $1- }
      if (%act.auto.resp) { 
        if (%away.cont. [ $+ [ $nick ] ] == $null) { .notice $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - One time response. }
        set -u180 %away.cont. [ $+ [ $nick ] ] - 
      }
    }
    halt
  }
}
on 1:TEXT:*:?:{
  if ($away == $true) {
    if (%page) { wa.log .: Info :: PM :: $nick $+ : $1- }
    if (%act.auto.resp) { 
      if (%away.cont. [ $+ [ $nick ] ] == $null) { .msg $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - One time response. }
      set -u180 %away.cont. [ $+ [ $nick ] ] - 
    }
  }
  halt
}
on 1:ACTION:*:?: {
  if ($away == $true) {
    if (%page) { wa.log .: Info :: PMA :: $nick $+ : $1- }
    if (%act.auto.resp) { 
      if (%away.cont. [ $+ [ $nick ] ] == $null) { .msg $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - One time response. }
      set -u180 %away.cont. [ $+ [ $nick ] ] - 
    }
  }
  halt
}

on 1:ACTION:*:#:{ 
  if ($me isin $strip($1-))  { 
    if ($away == $true) {
      if (%page) { wa.log .: Info :: $chan :: $nick $+ : $1- }
      if (%act.auto.resp) { 
        if (%away.cont. [ $+ [ $nick ] ] == $null) { .notice $nick $replace(%msg.away.st,[b],,[u],,[k],,[m],%razona,[h],%awaysal,[t],$duration($awaytime)) - One time response. }
        set -u180 %away.cont. [ $+ [ $nick ] ] - 
      }
    }
    halt
  }
}
on *:op:#: { 
  if ($away) && ($opnick == $me) { 
    if (%page) { wa.log .: Op :: $chan :: $nick $+ : $1- }
  }
}
on *:deop:#: { 
  if ($away) && ($opnick == $me) { 
    if (%page) { wa.log .: Deop :: $chan :: $nick $+ : $1- }
  }
}
on *:kick:#: { 
  if ($away) && ($knick == $me) { 
    if (%page) { wa.log .: Kick :: $chan :: $nick $+ : $1- }
  }
}
on *:ban:#: { 
  if ($away) && ($banmask iswm $address($me,5)) { 
    if (%page) { wa.log .: Ban :: $chan :: $nick $+ : $1- }
  }
}
on *:Disconnect: {
  set %awayon 0
  .timercheck.aaway off
}

; Dialogo principal
dialog awaysys {
  title "Away System"
  size -1 -1 138 35 
  option dbu
  box "Away Reason", 100, 1 1 136 33 
  combo 101, 3 9 132 10, drop edit sort
  ;
  box "Config", 200, 1 35 97 50
  check "Act. Autoaway      Mins:", 201, 5 42 65 10
  edit "", 202, 75 42 20 9, center
  check "Nick change:", 203, 5 52 45 10
  edit "", 204, 55 52 40 9, center
  check "Away spam every:", 205, 5 62 65 10
  edit "", 206, 75 62 20 9, center
  check "Auto answer Away", 207, 5 72 70 10
  box "Away-Log", 208, 99 35 37 25
  check "On", 209, 108 45 20 9 
  box "Spam", 211, 99 60 37 25
  radio "/ame", 212, 108 67 20 9 
  radio "/amsg", 213, 108 75 22 9
  ;
  button "▼", 301, 116 20 20 10
  button "Set Away", 302, 2 20 35 10 
  button "Away Back", 303, 2 20 35 10, hide
  button "Cerrar", 304, 40 20 35 10, cancel
  ;
  box "Away Msgs.", 401, 1 85 135 110
  text "Going Away:", 402, 3 93 40 10
  edit "", 403, 2 102 133 10, autohs
  text "Away:", 404, 3 113 40 10
  edit "", 405, 2 122 133 10, autohs
  text "Back Away:", 406, 3 133 40 10
  edit "", 407, 2 142 133 10, autohs
  button "Apply", 408, 43 183 55 10
  text [b] - Bold $+ $crlf $+ [u] - Underline $+ $crlf $+ [k] - Color, 409, 2 155 90 25, left
  text Away Msg - [m] $+ $crlf $+ Time Gone - [t] $+ $crlf $+ Out time - [h], 410, 45 155 90 25, right
}
;Eventos dialogo
on *:dialog:awaysys:*:*:{ 
  if ($devent == init) { 
    if ($did = 0) { info.away | update.away | away.dur | .timerdiaawadur 0 1 away.dur }
  }
  ;
  if ($devent == sclick) { 
    if ($did = 201) { set %act.auto.away $did($dname,201).state | update.away | if (%act.auto.away = 1) { .timercheck.aaway 0 30 autoawaycheck } | else { .timercheck.aaway off } }
    if ($did = 203) { set %act.cam.nick  $did($dname,203).state | update.away }
    if ($did = 205) { set %act.anun.nick $did($dname,205).state | update.away }
    if ($did = 207) { set %act.auto.resp $did($dname,207).state | update.away }
    if ($did = 209) { set %page $did($dname,209).state }
    if ($did = 212) { set %tipo.spam ame }
    if ($did = 213) { set %tipo.spam amsg }
    if ($did = 301) { if ($did(301) == ▼) { dialog -s $dname -1 -1 276 392 | did -ra $dname 301 ▲ } | else { dialog -s $dname -1 -1 276 70 | did -ra $dname 301 ▼ } }
    if ($did = 302) { set.away | update.away } 
    if ($did = 303) { set.back | update.away }
    if ($did = 408) { set %msg.awayon.st $did($dname,403) | set %msg.away.st $did($dname,405) | set %msg.awayoff.st $did($dname,407) } 
  }
  ;
  if ($devent == edit) {
    if ($did = 202) { set %tiempo.aaway $did($dname,202) | set %auto.away $calc(%tiempo.aaway * 60) }
    if ($did = 204) { set %nick.away    $did($dname,204) }
    if ($did = 206) { set %anuncio.away $did($dname,206) }
  }
  if ($devent == close) { .timerdiaawadur off }
}

Comments

Sign in to comment.
fahadmehar   -  11 days ago

Please Post Script In English.

eNkIL  -  10 days ago

Done

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.