Code:
Sub Init()
Script "Q-Whois by amir"
Hook "Chan_Msg"
Hook "Priv_Notice"
End Sub
Dim nChan, nNick, vCount, oCount, mCount, nCount, bCount, qAuth, qLevel, nChanFlags, inProgress
Sub Chan_Msg(Chan, Nick, RegUser, Line)
If LCase(Param(Line,1)) = ".qwhois" Then
If MatchFlags(GetUserFlags(RegUser), "+n") Then
If inProgress = 1 Then
Sendline "Notice " & Nick & " :There's something in progress, please wait.", 2
Exit Sub
End If
If Param(Line,2) <> "" Then
nChan = Chan
nNick = Param(Line,2)
vCount = 0
oCount = 0
mCount = 0
nCount = 0
bCount = 0
inProgress = 1
Sendline "Privmsg Q :whois " & nNick, 2
Else
Sendline "Notice " & Nick & " :Well, why don't you name me a nick to check?", 2
End If
Else
Sendline "Notice " & Nick & " :You have no access to this command.", 2
End If
End If
End Sub
Sub Priv_Notice(Nick, RegUser, Line)
If Nick = "Q" Then
If nChan = "" Then Exit Sub
If LCase(Line) = "who on earth is that?" Then
Sendline "Privmsg " & nChan & " :" & nNick & " is not on irc.", 2
inProgress = 0
nChan = ""
nNick = ""
Exit Sub
ElseIf Instr(1, LCase(Line), "is not authed") Then
Sendline "Privmsg " & nChan & " :" & nNick & " is not authed.", 2
inProgress = 0
nChan = ""
nNick = ""
Else
If Instr(1, LCase(Line), "is authed as") > 0 Then qAuth = Replace(Param(Line,5), ".", "")
If Instr(1, LCase(Line), "global auth level") > 0 Then qLevel = Replace(Param(Line,6), ".", "")
If Instr(1, LCase(Line), "access level") > 0 Then
If Instr(1, LCase(Param(Line,3)), "v") Then vCount = vCount + 1
If Instr(1, LCase(Param(Line,3)), "o") Then oCount = oCount + 1
If Instr(1, LCase(Param(Line,3)), "m") Then mCount = mCount + 1
If Instr(1, LCase(Param(Line,3)), "n") Then nCount = nCount + 1
If Instr(1, LCase(Param(Line,3)), "b") Then bCount = bCount + 1
End If
If Instr(1, LCase(Line), nChan) > 0 Then nChanFlags = Param(Line,3)
If Instr(1, LCase(Line), "end of list") Then
If nChanFlags = "" Then nChanFlags = "none"
Sendline "Privmsg " & nChan & " :" & nNick & "'s auth: " & qAuth & " [" & qLevel & "] ¤ Flags: " & vCount & " Voice | " & oCount & " Op | " & mCount & " Master | " & nCount & " Owner | " & bCount & " Ban ¤ Flags on " & nChan & ": " & nChanFlags, 2
inProgress = 0
nNick = ""
nChan = ""
nChanFlags = ""
ElseIf Instr(1, LCase(Line), "not known in any") Then
Sendline "Privmsg " & nChan & " :" & nNick & "'s auth: " & qAuth & " [" & qLevel & "] ¤ This user is not known in any channels.", 2
inProgress = 0
End If
End If
End If
End Sub
amir's auth: AmiR [1] ¤ Flags: 10 Voice | 6 Op | 3 Master | 1 Owner | 0 Ban ¤ Flags on #sajuko!: +amnotv