Chaninfo

By Veritas on Aug 27, 2011

Hello guys!

I was bored yesterday and decided to make a little snippet for some channel information. I saved the data on a .ini file and here's a list of what it exactly does:

  • Saves the amount of lines said in the channel.
  • Saves the amount of words said in the channel.
  • Saves the amount of tokens said in the channel.
  • Saves the record of how many people were in the channel.

Example:

[17:38:05] <07+Veritasweg> !textinfo [17:38:05] <04@Veri||BOT> Info of #channel since 26-08-2011
[17:38:05] 04@`Veri||BOT Lines: 1390.
[17:38:05] 04@`Veri||BOT Words: 5514.
[17:38:05] 04@`Veri||BOT Tokens: 30668.
[17:38:05] 04@`Veri||BOT Record amount of people on #channel: 21.

I hope you guys enjoy it and please leave some messages about what can be better or some suggestions :).

[UPDATES]

  • Added flood protection. Thanks to Jethro_.
  • Added option to add and remove channels from the list.
\\
The first on text command stores all the data into the .ini file. If you want to add or remove a channel from the list just type $chan add of $chan del.
\\

on *:TEXT:*:%channels: {
  var %words $0
  var %tokens $len($1-)
  var %iniwords $readini(chaninfo.ini,#,words)
  var %inilines $readini(chaninfo.ini,#,lines)
  var %initokens $readini(chaninfo.ini,#,tokens)
  var %allwords $calc(%iniwords + %words)
  writeini -n chaninfo.ini # words %allwords
  writeini -n chaninfo.ini # lines $calc(%inilines + 1)
  writeini -n chaninfo.ini # tokens $calc(%initokens + %tokens)
}

on *:JOIN:%channels: {
  var %people $nick(#,0)
  var %record $readini(chaninfo.ini,#,people)
  if (%people > %record) {
    .msg # NEW RECORD BABY!!!! Amount of people now: %people $+ . Old record: %record $+ . (Since 26-08-2011)
    writeini -n chaninfo.ini # people %people 
  }
}

on *:text:$($iif(!textinfo == $strip($1),$1)):%channels:{
  .ignore -cu3 $nick 2
  var %c 1, %m = $+(Info of # since $readini(chaninfo.ini,#,date),|,$&
    $+ Lines: $readini(chaninfo.ini,#,lines),.,|,$&
    $+ Words: $readini(chaninfo.ini,#,words),.,|,$&
    $+ Tokens: $readini(chaninfo.ini,#,tokens),.,|,$&
    $+ Record amount of people on  # $+ : $readini(chaninfo.ini,#,people),.)
  while $gettok(%m,%c,124) {
    .timer 1 $calc(%c *2) .msg # $v1
    inc %c
  }
}

on *:TEXT:$chan*:#:{
   if ($2 == add && # !isin %channels) {
      set %channels %channels $+ , $+ #
      .msg # Channel successfully added.
      writeini -n chaninfo.ini # words 0
      writeini -n chaninfo.ini # lines 0
      writeini -n chaninfo.ini # tokens 0
      writeini -n chaninfo.ini # people $nick(#,0)
      writeini -n chaninfo.ini # date $replace($date,/,-)
   }
    if ($2 == del && # isin %channels) {
      set %channels $remove(%channels,#)
      .msg # Channel successfully deleted.
      remini chaninfo.ini #
   }
 }

Comments

Sign in to comment.
Veritas   -  Aug 28, 2011

Lol thnx PyTh0n:p

@ Jethro_

I added an option to add and remove channels from the list and solved the date thing. When you add a channel to the list it saves the startdate of that specific channel into the .ini file. I did this instead of %date, because if you use it on many channels you need too many variables ;).

 Respond  
PyThOn   -  Aug 27, 2011

Nice Nice Nice. From Jethro_ And Captin America guy lmao!

 Respond  
Jethro   -  Aug 27, 2011

Opps, my bad.

Put this on the first text event:

if (!%date) { set %date $replace($date,/,-) }

you can then use %date to refer to the date the script that's triggered on that particular day.

and finally make another command to have the variable deleted if you decide to start anew.

 Respond  
Veritas   -  Aug 27, 2011

Thnx for your help Jethro_ :). I replaced $replace($date,/,-) to "date when you activated the script", because if you use $date it will reflect the current date, but NOT the date when you activated the script.

Anyways, I editted the script with your ideas. I tested it and it works :).

 Respond  
Jethro   -  Aug 27, 2011

You may consider using a timed delay for the ouput, rather than have them all come out at one time. Some networks or ops kick/ban for line flood if there are 5 or 6 lines sent immediately. We can't be too careful these days:

on *:text:$($iif(!textinfo == $strip($1),$1)):#:{
  .ignore -cu3 $nick 2
  var %c 1, %m = $+(Info of #channel since $replace($date,/,-),|,$&
    $+ Lines: $readini(chaninfo.ini,#,lines),.,|,$&
    $+ Words: $readini(chaninfo.ini,#,words),.,|,$&
    $+ Tokens: $readini(chaninfo.ini,#,tokens),.,|,$&
    $+ Record amount of people on  # $+ : $readini(chaninfo.ini,#,people),.)
  while $gettok(%m,%c,124) {
    .timer 1 $calc(%c *2) .msg # $v1
    inc %c
  }
}

Use the identifier $date so it reflects today's date instead of get it hard-coded manually:

$replace($date,/,-)

The ignore command is to ignore the possibility of a trigger flood. Every user can merely trigger the code every 3 seconds.

 Respond  
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.