/infochan

By L4roXyL on Aug 20, 2009

Use: /infochan
Example: /infochan #example

-

Channel info:
Total user
Registered nick
Total away user - Nick(s)
Here user(no away)
Total prefixes user - Nick(s)
Total bot - Nick(s)
Connected server - Total user
Total IRC-op - Nick(s)

Total clone
Clone(s) - Nick(s)

;a code by l4roxyl
;24/07/2009 
;-
;start code
alias -l qt returnex $+($chr(2),$1-,$chr(2))
alias infochan {
  var %_ec = echo -aceq info $str($chr(149),3) /infochan:
  if ($1) { 
    if ($hget($1,_delay)) { %_ec Same channel( $+ $1 $+ ) pls $hget($1,_delay).unset seconds waiting. | returnex }
    if ($1 !ischan) { %_ec $1 no such channel. | returnex }
  }
  else { %_ec insufficient parameters. /infochan <#channel> | returnex }
  hinc -mu10 $1 _delay 1 | .enable #_chan_info | who $1
}
#_chan_info off
raw *:*: {
  haltdef | tokenize 32 $rawmsg 
  if ($2 = 352) {
    hinc -m $+(stats_,$4) _all_user 1 | hinc -m $+(stats_,$4) $+(server_,$7) 1
    if ($7 = $server) hinc -m $+(stats_,$4) _server 1
    hadd -m $+(stats_,$4) $6 $addtok($hget($+(stats_,$4),$6),$8,63)
    if ($regex($9,\*)) { 
      hinc -m $+(stats_,$4) _irc_op 1
      hadd -m $+(stats_,$4) _ircop_nick $addtok($hget($+(stats_,$4),_ircop_nick),$8,44)
    }
    if ($regex($9,G)) { 
      hinc -m $+(stats_,$4) _away 1 
      hadd -m $+(stats_,$4) _away_nick $addtok($hget($+(stats_,$4),_away_nick),$8,44)
    }
    if ($regex(prefix,$9,(@|&|%|\+|~))) { 
      hinc -m $+(stats_,$4) _prefixes 1 
      hadd -m $+(stats_,$4) _prefixes_nick $addtok($hget($+(stats_,$4),_prefixes_nick),$+($regml(prefix,1),$8),44)
    }
    if ($regex($9,B)) { 
      hinc -m $+(stats_,$4) _bot 1 
      hadd -m $+(stats_,$4) _bot_nick $addtok($hget($+(stats_,$4),_bot_nick),$8,44)
    }
    if ($regex($9,H)) hinc -m $+(stats_,$4) _here 1
    if ($regex($9,r)) hinc -m $+(stats_,$4) _reg_nick 1
  }
  if ($2 = 315) {
    echo -c info $4 $str($chr(175),30) $4 info start $str($chr(175),30)
    var %_str = echo -c info $4 $str($chr(149),3) 
    %_str Total user: $//qt($hget($+(stats_,$4),_all_user))
    if ($hget($+(stats_,$4),_reg_nick)) { 
      %_str Registered nick: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    if ($hget($+(stats_,$4),_away)) {
      %_str Away user(s): $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $&
        $regsubex($hget($+(stats_,$4),_away_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    if ($hget($+(stats_,$4),_here)) {
      %_str Here user(s): $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    if ($hget($+(stats_,$4),_prefixes)) {
      %_str Prefixes nick: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
      %_str Prefixes nick(s): $//qt($regsubex($regsubex($hget($+(stats_,$4),_prefixes_nick),/ $+ $chr(44) $+ /g,$chr(32)),/([@&%+~])/g,$+($chr(40),\1,$chr(41))))
    }
    if ($hget($+(stats_,$4),_bot)) {
      %_str Bots: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $regsubex($hget($+(stats_,$4),_bot_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    var %_sttl = $calc($hget($+(stats_,$4),_server) *100/ $hget($+(stats_,$4),_all_user))
    %_str Connected server: $//qt($server) - Users: $//qt($hget($+(stats_,$4),_server)) $+($chr(40),%,$left(%_sttl,4),$chr(41)))
    if ($hget($+(stats_,$4),_irc_op)) {
      %_str IRC-op(s): $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $&
        $regsubex($hget($+(stats_,$4),_ircop_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    if ($hfind($+(stats_,$4),\?,0,r).data) {
      %_str Total clone(s): $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    var %1 = 1,%_clonnick
    while ($hfind($+(stats_,$4),\?,%1,r).data) {
      %_clonnick = $regsubex($hget($+(stats_,$4),$v1),/(\?)/g,$chr(32) - $+ $chr(32))
      %_str Add: $//qt($v1) - $+(Nicks,$chr(40),$numtok(%_clonnick,45),$chr(41),:) $//qt(%_clonnick)
      inc %1
    }
    echo -c info $4 $str(_,30) $4 info end $str(_,30)
    hfree $+(stats_,$4) | .disable #_chan_info
  }
}
#_chan_info end
;end code

Comments

Sign in to comment.
Protheus   -  Nov 21, 2011

Very nice. VERY impressive. 10/10.

 Respond  
L4roXyL   -  Sep 15, 2009

Jethro_; Hash table ever since i first began to abandon scripting. Thanks.

 Respond  
Jethro   -  Sep 15, 2009

It's so nice to see someone who uses hash tables for a change. Keep it up, L4roXyL.

 Respond  
L4roXyL   -  Sep 14, 2009

DragonHeart; You should change the returnex return
Xpl0reR; on me:*:join:#:infochan #
Phoenix-; Thanks.

 Respond  
CoCoRiCo   -  Sep 14, 2009

nice nice, do not stop continue writing q~:

 Respond  
Phoenix-   -  Aug 22, 2009

@Xpl0reR: You realize those will enable the next RAW commands when you use /infochan so you won't be spammed when someone joins/dc's/etc... The Raw's will not be affected when its not enabled.
Also, I'm not entirely too sure !== works. I know != does but I've never seen !== used.
If you disconnect, why create a flood halt? On Start is when you open it and not everyone connections directly On Start. I think what you mean is

On *:connect:{ .timer 1 40 unset %anti.infochan.flood }
 Respond  
xplo   -  Aug 21, 2009

i added this to the code to make it perfect.

on *:join:#:{ 
  if (%anti.infochan.flood) { HALT } 
  if ($nick !== $me) { halt }
  else { infochan # }
}
on *:DISCONNECT:{ set %anti.infochan.flood on }
on *:START:{ .timer 1 40 unset %anti.infochan.flood }

it should be added if someone wants to use this script eeverytime you join a channel, but when you start mirc. it will not give out results, ( for preventing flood )
40 secs after you can make /hop if you want.

 Respond  
xplo   -  Aug 21, 2009

Really cool Code. Usefull and complete. i give a 10/10
you deserve it for the originality.

 Respond  
sk68   -  Aug 21, 2009

awesome, its like /whois for channels =D

9/10 +1 like and will recommend ^^

 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.