Author Topic: Inactive Chatters  (Read 2548 times)

Rizzo

  • Newbie
  • *
  • Posts: 3
Inactive Chatters
« on: July 19, 2008, 12:25:35 AM »
I would like a script that would kick a member out if they haven't posted a channel message in 30 mins (excluding operators).

No ban, just a kick.

I have searched but can't see anything like this, so hoping someone might be able to help :)

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: Inactive Chatters
« Reply #1 on: August 07, 2008, 08:16:41 AM »
Umm.. A little late but heres a basic script that does this.

Code: [Select]
inactive = "inactive.ini"

Sub PruneInactive(Channel,ServerNumber)
  For i=1 to GetIdentifier("$chan(" & channel & ").count",ServerNumber)
    nick = GetIdentifier("$nick(" & channel & "," & i & ").nick",ServerNumber)
    NetChan = GetIdentifier("$network",ServerNumber) & ":" & Channel
    tmp = GetIniFile(inactive,netchan,"Nick_" & nick,"")
    if len(tmp)=0 then
      tmp = now
      writeinifile inactive,netchan,"Nick_" & nick, tmp
    End If
    if datediff("N",tmp,now) >= int(GetIniFile(inactive,netchan,"inactive","30")) then
      if not ISOP(nick,channel,servernumber) then
        SendCommand "/kick " & channel & " " & nick & " " & GetIniFile(inactive,netchan,"msg","Kick for being inactive."),ServerNumber
        WriteIniFile inactive, netchan, "Nick_" & nick,""
      end if
    End If
  Next
  timername = GetIdentifier("$network",ServerNumber) & Mid(Channel,2) & "Pruner"
  SendCommand "/timer " & timername & " off",ServerNumber
  SendCommand "/timer " & timername & " 1 " & int(GetIniFile(inactive,netchan,"prune","5"))*60 & " /! PruneInactive " & channel & " | " & ServerNumber,ServerNumber
End Sub

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
  NetChan = GetIdentifier("$network",ServerNumber) & ":" & Channel
  if GetINIFile(inactive,netchan,"enabled",0) = 1 then WriteIniFile inactive, netchan, "Nick_" & nickname, now
End Sub

Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
  if lcase(Nickname)=lcase(GetIdentifier("$me",ServerNumber)) then
    NetChan = GetIdentifier("$network",ServerNumber) & ":" & Channel
    if int(GetINIFile(inactive,netchan,"enabled","0")) = 1 then
      timername = GetIdentifier("$network",ServerNumber) & Mid(Channel,2) & "Pruner"
      SendCommand "/timer " & timername & " 1 " & int(GetIniFile(inactive,netchan,"prune","5"))*60 & " /! PruneInactive " & channel & " | " & ServerNumber,ServerNumber
    end if
  end if
End Sub

To enable it, make a text file in the scripts directory called inactive.ini.

Sample configuration file:

Code: [Select]
[QuakeNet:#icechat]
enabled = 1
prune = 5
inactive = 30

"prune" is how often the script is ran. Note, the script starts once you join the channel, so if you setup the script for the first time and are already in the channel, just rejoin it after config.

"inactive" is how long someone can go for without talking, in minutes.
This message brought to you by the Wonderful Wizard of Oz.