AnGelBot-Portal²

Normale Version: Q whois script
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallöchen ich suche ein script um die flags von einem user abzufragen, aber über q.

Ich stelle es mir so vor:

nur BotOwner können es benutzen.
Bei !qcheck <nick> führt der bot ein ".say q whois <nick>" aus, liest dann die flags aus.

zählt die einzelnen flags zusammen und gibt es so aus (z.B.)

Q whois for <nick>
Flags: 2 Master | 3 Owner | 15 Auto | 23 Op | 15 Voice

oder sonst eben: <nick> no such user

wäre super wenn das einer machen könnte.

Danke im Vorraus.

MfG
aXL
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

Sub Chan_Msg(Chan, Nick, RegUser, Line)
If LCase(Param(Line,1)) = ".qwhois" Then
  If MatchFlags(GetUserFlags(RegUser), "+n") Then
    If Param(Line,2) <> "" Then
      nChan = Chan
      nNick = Param(Line,2)
      vCount = 0
      oCount = 0
      mCount = 0
      nCount = 0
      bCount = 0
      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 either not authed or offline.", 2
    nChan = ""
    nNick = ""
    Exit Sub
  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), "end of list") Then
      Sendline "Privmsg " & nChan & " :" & nNick & "'s auth: " & qAuth & " [" & qLevel & "] ¤ Flags: " & vCount & " Voice | " & oCount & " Op | " & mCount & " Master | " & nCount & " Owner | " & bCount & " Ban", 2
      nNick = ""
      nChan = ""
    End If
  End If
End If
End Sub
sieht so aus:

amir's auth: AmiR [1] ¤ Flags: 10 Voice | 6 Op | 3 Master | 1 Owner | 0 Ban

hf!
cool, thx!
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

Sub Chan_Msg(Chan, Nick, RegUser, Line)
If LCase(Param(Line,1)) = ".qwhois" Then
  If MatchFlags(GetUserFlags(RegUser), "+n") Then
    If Param(Line,2) <> "" Then
      nChan = Chan
      nNick = Param(Line,2)
      vCount = 0
      oCount = 0
      mCount = 0
      nCount = 0
      bCount = 0
      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 either not authed or offline.", 2
  ElseIf LCase(Line) = "user not known in any channels." Then
    SendLine "Privmsg " & nChan & " :" & nNick & " is not known in any Channels", 2
    nChan = ""
    nNick = ""
    Exit Sub
  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), "end of list") Then
      Sendline "Privmsg " & nChan & " :" & nNick & "'s auth: " & qAuth & " [" & qLevel & "] ¤ Flags: " & vCount & " Voice | " & oCount & " Op | " & mCount & " Master | " & nCount & " Owner | " & bCount & " Ban", 2
      nNick = ""
      nChan = ""
    End If
  End If
End If
End Sub

Da hat was noch nicht perfekt funktioniert :D
Code:
Else
    Sendline "Notice " & Nick & " :You have no access to this command.", 2

Diese Stelle sollte man allerdings rausnehmen, sonst bekommen die, von denen man die Flags nachgeschaut haben dauerthaft Notices vom Bot, sobald sie etwas sagen Smile
öhm, das sollte mit dem einen edit behoben sein :|

edit: so funzt es bei mir ohne probs, weiss net was ihr habt:
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
Referenz-URLs