-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForwardWhispers.txt
62 lines (52 loc) · 2.1 KB
/
ForwardWhispers.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
' THESE SCRIPTS ARE FOR DEV RELEASE 38 ONLY, NOT TESTED AND NOT SUPPORTED FOR 2.6.
' RIBOSE
Option Explicit
Script("Name") = "ForwardWhispers"
Script("Author") = "Ribose"
Script("Major") = 1
Script("Minor") = 3
Script("Revision") = 20171220
Const FWD_OWNER = "%o"
Const FWD_FRIEND = "%f"
Sub Event_Load()
CreateObj "Menu", "mnuSetUser"
mnuSetUser.Caption = "Set Forward Whisper User"
End Sub
Sub mnuSetUser_Click()
Dim ForwardTo, InputMsg
InputMsg = _
"Set the user to forward all whispers to." & vbNewLine & _
"Use " & UCase(FWD_OWNER) & " to whisper the bot's current owner." & vbNewLine & _
"Use " & UCase(FWD_FRIEND) & " to whisper the bot's current friends." & vbNewLine & _
"Leave blank or hit Cancel to cancel."
ForwardTo = LCase(Trim(GetSettingsEntry("ForwardTo")))
If Len(ForwardTo) = 0 Then ForwardTo = FWD_OWNER
ForwardTo = InputBox(InputMsg, "Forward Whisper Script - StealthBot", ForwardTo)
If Len(Trim(ForwardTo)) = 0 Then ForwardTo = FWD_OWNER
If ForwardTo <> vbNullString Then WriteSettingsEntry "ForwardTo", ForwardTo
End Sub
Sub Event_WhisperFromUser(Username, Flags, Message, Ping)
ReceivedWhisper Username, Message
End Sub
Sub ReceivedWhisper(Username, Message)
Dim fwduser, fwdmsg
' Don't forward friend logon/logoff messages.
If Match(Message, "Your friend * has e*ed Battle.net.", True) Then Exit Sub
' Don't forward messages from the email service.
If Username = "# Email Service #" Then Exit Sub
fwduser = LCase(Trim(GetSettingsEntry("ForwardTo")))
fwdmsg = "Whisper from " & Username & ": " & Message
If Len(fwduser) = 0 Then fwduser = FWD_OWNER
If fwduser = FWD_OWNER Then fwduser = BotVars.BotOwner
If fwduser = FWD_FRIEND Then
AddQ "/f m " & fwdmsg
Else
If StrComp(fwduser, Username, vbTextCompare) <> 0 Then
If BotVars.Product = "VD2D" Or BotVars.Product = "PX2D" Then
AddQ "/w *" & fwduser & " " & fwdmsg
Else
AddQ "/w " & fwduser & " " & fwdmsg
End If
End If
End If
End Sub