Changelog: (I will update this as you post new code, insure to include what you do though)
[div class='codetop']CODE[/div][div class='codemain' style='height:200px;white-space:pre;overflow:auto']
'// 0.25
'// ~Vector
'// - Replaced Smart Kick timer with GetGTC
'// this should solve several issues related to kicking a user for re-joining
'// too fast. Default time is 3 seconds
'// 0.24
'// ~Vector
'// - AM will not attempt to close the channel if its already closed
'// 0.23
'// ~Vector
'// - Added back in EXECUTOR after realizing its purpose (D'oh..)
'// 0.22
'// ~Vector
'// - Finished adding in Smart Banning
'// - Added Smart Kick, enabled by default
'// - Added .ini settings for Smart Ban/Kick and Limit
'// - Ping ban is by default off
'// - Added beta check
'// - // instead of / from in-bot shows the command response in chat
'// - added "toggleskick" command for smart kicking
'// 0.211
'// ~Shadow
'// - Fixed to work with Stealthbot 2.6 R3
'// 0.21
'// ~Shadow
'// - Added Safelist checking
'// 0.20
'// ~Vector
'// - Added debugging class. (I only added most messages in Event_Load() to it)
'// (If you want to add other messages within the plugin, please do so)
'// (Ex. Debug.Write Color, text)
'// - Removed AMV constant. Used psVersions.Item("am") instead
'// 0.19
'// ~Vector
'// - Fixed first eight lines to provide the plugin manager format
'// - Added Smart Banning (Zone, you lazy ass)
'// 0.18
'// ~Hero
'// - Cleaned up for noob (vector*)
'// - Fixed a problem where the bot says WAY too many messages when it has no ops.
'// 0.17
'// ~Vector
'// - Added "admin" and "noadmin" commands (999 access)
'// - Fixed major problem with limitation command
'// - Added various checks and bounds to limit command
'// - added nolimit command (default of 100 access)
'// 0.16
'// ~Vector
'// - Added Access Limitation feature
'// - Minor fixes
'// 0.15
'// ~Hero
'// = Fixed NumSpam w/ Shadow
'// 0.14
'// ~Hero
'// - Re-added NumSpam
'// - Created settings for NumSpam
'// -
'// 0.13
'// ~Ace
'// - Added NumSpam
'// 0.12
'// ~Hero
'// - Added Vector to created by
'// - Converted to .INI
'// - Fixed Shadow's massload detect (Sorry I changed it a lot - sorta redid 1/2 of it)
'// - Added settings to Shadow's massload detect
'// - Added .AMreload command to reload settings
'// 0.09
'// ~Shadow
'// - Massload detect
'// 0.08
'// ~Hero
'// - Decided not to use .ini
'// - Tidied up load sub
'// - Tidied up settings area
'// 0.07
'// ~Vector
'// - Added ping banning, settings included
'// 0.06
'// ~Hero
'// - AMWordSpamPunishment setting
'// - Added bot checking for ops before kicking
'// 0.05
'// ~Hero
'// - AMWordSpam - Completed
'// 0.01
'// ~Hero
'// - Setup Process Input
'// - Started Load sub
'// - Basic layout
'// - Few settings
'// - Prefixed AddChats
'// - Text sending functions
[/div]
'AM
'0.25
'&Advanced Moderation:Shadow, Tech, Vector, 7thAce, and Hero:Expands stealthbot's moderation ability
'*
'*
'*
'*
'*StealthBot Enhancement
'# # # # # # # # # # # # # #
'// SETTING DESCRIPTIONS //
'# # # # # # # # # # # # # #
'// # # / GLOBAL DEBUGGER / # # //
'// Define the debugger variable
Dim Debug
'// Is global debugging enabled?
Private AMDebugGlobal
AMDebugGlobal = False
'// # # / WORD Spam / # # //
'// [Word Spam]
'// Use the word anti-Spam
'// "Enabled"
Private AMWordSpamEnabled
'// Amount of times a word can be said in x seconds
'// "Count"
Private AMWordSpamCount
'// Amount of time it takes to refresh SpamCount
'// "Refresh Rate"
Private AMWordSpamRefresh
'// Punishment when they Spam
'// "Punishment"
'// Use kick or ban
Private AMWordSpamPunishment
'// # # / Access Limit / # # //
'// Prevents use of the limit command if bot is a beta bot
Private AMLockLimit
AMLockLimit = False
'// Is Access Limitation enabled?
Private AMAccessLimitBool
AMAccessLimitBool = True
Private AMAddSetCommand, AMLimitUsersAcc
'// Default AM Setting for "add" and "set" commands
AMAddSetCommand = 60
'// access for limit command
AMLimitUsersAcc = 150
'// Access to give a user the A flag
Private AMAdminFlagAcc
AMAdminFlagAcc = 200
'// # # / NUM SPAM / ## //
'// [NumSpam]
'// Use NumSpam
'// "Enabled"
Private AMNumSpamEnabled
'// Limit, the higher you make this the longer it takes to detect a flood
'// "Limit"
Private AMNumSpamLimit
'// Punishment for Starcraft Brood War
'// "BroodWar"
Private AMNumSpamSEXP
'// Punishment for Starcraft
'// "Starcraft"
Private AMNumSpamSTAR
'// Punishment for using a LagPlug
'// "Lag Plug"
Private AMNumSpamLagPlug
'// Time between refreshing
'// "Refresh"
Private AMNumSpamRefrsh
'// # # / SMART KICKING / # # //
Private AMSmartKickEnabled
AMSmartKickEnabled = False
Private AMSmartKickTime
'// 1000 = 1 second
AMSmartKickTime = 3000
Set dicSmartKick = CreateObject("Scripting.Dictionary")
'// # # / SMART BANNING / # # //
Private AMSmartBanEnabled
AMSmartBanEnabled = True
Set dicSmartBans = CreateObject("Scripting.Dictionary")
'// # # / PING BANNING / # # //
'// [Ping Ban]
'// Use ping bans
'// "Enabled"
Private AMPingBanEnabled
'// Punishment when they have too high of a ping
'// "Punishment"
'// Use kick or ban
Private AMPingBanPunishment
'// If a users ping is equal to or above this they will be kicked/banned
'// "Ping to ban"
Private AMPingToBan
'// # # / JOIN Spam / # # //
'// [Join Spam]
'// Use the join anti-Spam
'// "Enabled"
Private AMJoinSpamEnabled
'// Amount of times people can join in x seconds
'// "Count"
Private AMJoinSpamCount
'// Amount of time it takes to refresh SpamCount
'// "Refresh Rate"
Private AMJoinSpamRefresh
'// Punishment when they Spam
'// "Punishment"
'// Use kick or ban
Private AMJoinSpamPunishment
'// How long to wait before unlocking the channel
'// In Seconds **
'// 300 = 5 min
'// 900 = 15 min
'// 1800 = 1/2 hour
'// 3600 = 1 hour
Private AMJoinSpamUnlock
'# # # # # # # # # # # # # #
'// // // CHANGELOG // // //
'# # # # # # # # # # # # # #
'// 0.25
'// ~Vector
'// - Replaced Smart Kick timer with GetGTC
'// this should solve several issues related to kicking a user for re-joining
'// too fast. Default time is 3 seconds
'// 0.241
'// ~Vector
'// - Fixed various issues
'// 0.24
'// ~Vector
'// - AM will not attempt to close the channel if its already closed
'// 0.23
'// ~Vector
'// - Added back in EXECUTOR after realizing its purpose (D'oh..)
'// 0.22
'// ~Vector
'// - Finished adding in Smart Banning
'// - Added Smart Kick, enabled by default
'// - Added .ini settings for Smart Ban/Kick and Limit
'// - Ping ban is by default off
'// - Added beta check
'// - // instead of / from in-bot shows the command response in chat
'// - added "toggleskick" command for smart kicking
'// 0.211
'// ~Shadow
'// - Fixed to work with Stealthbot 2.6 R3
'// 0.21
'// ~Shadow
'// - Added Safelist checking
'// 0.20
'// ~Vector
'// - Added debugging class. (I only added most messages in Event_Load() to it)
'// (If you want to add other messages within the plugin, please do so)
'// (Ex. Debug.Write Color, text)
'// - Removed AMV constant. Used psVersions.Item("am") instead
'// 0.19
'// ~Vector
'// - Fixed first eight lines to provide the plugin manager format
'// - Added Smart Banning (Zone, you lazy ass)
'// 0.18
'// ~Hero
'// - Cleaned up for noob (vector*)
'// - Fixed a problem where the bot says WAY too many messages when it has no ops.
'// 0.17
'// ~Vector
'// - Added "admin" and "noadmin" commands (999 access)
'// - Fixed major problem with limitation command
'// - Added various checks and bounds to limit command
'// - added nolimit command (default of 100 access)
'// 0.16
'// ~Vector
'// - Added Access Limitation feature
'// - Minor fixes
'// 0.15
'// ~Hero
'// = Fixed NumSpam w/ Shadow
'// 0.14
'// ~Hero
'// - Re-added NumSpam
'// - Created settings for NumSpam
'// -
'// 0.13
'// ~Ace
'// - Added NumSpam
'// 0.12
'// ~Hero
'// - Added Vector to created by
'// - Converted to .INI
'// - Fixed Shadow's massload detect (Sorry I changed it a lot - sorta redid 1/2 of it)
'// - Added settings to Shadow's massload detect
'// - Added .AMreload command to reload settings
'// 0.09
'// ~Shadow
'// - Massload detect
'// 0.08
'// ~Hero
'// - Decided not to use .ini
'// - Tidied up load sub
'// - Tidied up settings area
'// 0.07
'// ~Vector
'// - Added ping banning, settings included
'// 0.06
'// ~Hero
'// - AMWordSpamPunishment setting
'// - Added bot checking for ops before kicking
'// 0.05
'// ~Hero
'// - AMWordSpam - Completed
'// 0.01
'// ~Hero
'// - Setup Process Input
'// - Started Load sub
'// - Basic layout
'// - Few settings
'// - Prefixed AddChats
'// - Text sending functions
'# # # # # # # # # # # # # #
'// // / DECLARATIONS / // //
'# # # # # # # # # # # # # #
Private AMMessages '// As Scripting.Dictionary
Private AMMessagesUsers '// As Scripting.Dictionary
Private AMJoins '// As Int
Private AMSettingsPath '// As String
Private AMLimitsPath '// As String
Private AMFSO '// As Scripting.FileSystemObject
Private AMNumSpam_Status '// As Int
Private AMIsLocked '// As Boolean
AMIsLocked = False
'// Base values
AMJoins = 0
Set AMMessages = CreateObject("Scripting.Dictionary")
Set AMMessagesUsers = CreateObject("Scripting.Dictionary")
AMSettingsPath = BotPath & "ModerationSettings.ini"
AMLimitsPath = BotPath & "UserLimits.ini"
Set AMFSO = CreateObject("Scripting.FileSystemObject")
'################################
'// Please do not edit below here
'################################
'// Prefix for addchats
AMP = Chr(255) & "cb" & "[AM] " & Chr(255) & "cb"
Sub AM_Event_Load
Set Debug = New debugging
Debug.Write vbYellow, "Loading..."
Debug.Write vbYellow, "Checking for settings file..."
If AMFSO.FileExists(AMSettingsPath) Then
Debug.Write vbGreen, "Found!"
Else
Debug.Write vbRed, "File missing!"
Debug.Write vbYellow, "Creating..."
AMFSO.CreateTextFile(AMSettingsPath)
Debug.Write vbGreen, "Created!"
End If
Debug.Write vbYellow, "Loading settings..."
Call AM_LoadSettings
Debug.Write vbGreen, "Loaded settings!"
Debug.Write vbYellow, "Initializing timers..."
TimerInterval "AM", "MessageSpam_refresh", CInt(AMWordSpamRefresh)
TimerEnabled "AM", "MessageSpam_refresh", True
TimerInterval "AM", "JoinSpam_refresh", CInt(AMJoinSpamRefresh)
TimerEnabled "AM", "JoinSpam_refresh", True
TimerInterval "AM", "Unlock_Channel", CInt(AMJoinSpamUnlock)
TimerEnabled "AM", "Unlock_Channel", False
TimerInterval "AM", "Lock_Channel", 1
TimerEnabled "AM", "Lock_Channel", False
TimerInterval "AM", "NumSpam_refresh", CInt(AMNumSpamRefresh)
TimerEnabled "AM", "NumSpam_refresh", True
Debug.Write vbGreen, "Intialized timers!"
AddC vbYellow, "Retrieving ping ban status..."
If AMPingBanEnabled Then
AddC vbGreen, "Pingban is currently on and " & AMPingBanPunishment & "ing users with a ping of " & AMPingToBan & " or higher"
Else
AddC vbGreen, "Pingban is currently off"
End If
AddC vbYellow, "Retriving NumSpam limit..."
AddC vbGreen, "NumSpam has a current limit of: " & AMNumSpamLimit
If InStr(Lcase(GetBotVersion), "beta") Then
AddChat vbRed, "?cb[AM]?cb StealthBot beta detected."
AddChat vbRed, "?cb[AM]?cb access limitation feature blocked."
AMLockLimit = True
Else
Debug.Write vbYellow, "Access limitation status: " & AMAccessLimitBool
If AMAccessLimitBool Then
Debug.Write vbYellow, "Checking limitations of ""add"" and ""set"" commands..."
If GetConfigEntry("numeric", "add", "access.ini") = "" Or _
GetConfigEntry("numeric", "set", "access.ini") = "" Then
Debug.Write vbYellow, "Changing access of ""add"" and ""set"" to 1000..."
WriteConfigEntry "numeric", "add", 1000, "access.ini"
WriteConfigEntry "numeric", "set", 1000, "access.ini"
Debug.Write vbGreen, "Done correcting limitations."
End If
Else
If GetConfigEntry("numeric", "add", "access.ini") <> 70 Or _
GetConfigEntry("numeric", "set", "access.ini") <> 70 Then
WriteConfigEntry "numeric", "add", 70, "access.ini"
WriteConfigEntry "numeric", "set", 70, "access.ini"
Debug.Write vbYellow, "Set both ""add"" and ""set"" commands to default values."
End If
End If
Debug.Write vbGreen, "Done checking AM Limitation function."
End If
'// The end
AddC vbGreen, "You are using version " & psVersions.Item("am")
AddC vbOrange, "Created by: " & Chr(255) & "ciShadow, Tech, Vector, and Hero" & Chr(255) & "ci"
End Sub
'// Execute when a user (Other then the bot) sends chat to battle.net
Sub AM_Event_Usertalk(Username, Flags, Text, Ping)
'// Check for commands
Call AM_ProcessInput(Username, Flags, Text, 1)
'// Anti-Word Spam
'// Add one to the Amount of times a message was said
AMMessages.Item(Text) = AMMessages.Item(Text) + 1
'// Add to the people
'// Make sure they aren't in it already
If Not InStr(AMMessagesUsers.Item(Text), Username) > 0 Then
AMMessagesUsers.Item(Text) = AMMessagesUsers.Item(Text) & Username & ":"
End If
If AMMessages.Item(Text) >= AMWordSpamCount Then
AddC vbYellow, "Spam Detected!"
AddC vbYellow, "Text: " & Text
'// Get people who used it
People = AMMessagesUsers.Item(Text)
'// Remove extra :
People = Left(People, Len(People) - 1)
sPeople = Split(People, ":")
AddC vbYellow, "Removing Spammers..."
For i = LBound(sPeople) To UBound(sPeople)
If BotFlags = 2 Then
If GetInternalDataByUsername(sPeople(i), 1) = 2 Then
AddC vbRed, "Spammer has ops (" & sPeople(i) & ")"
Else
If IsSafelisted(Username) Then Exit Sub
If AMSmartBanEnabled And Not dicSmartBans.Exists(Username) Then
AddQ "/" & AMWordSpamPunishment & " " & sPeople(i) & " Spamming: " & Text
End If
End If
Else
AddC vbRed, "Bot does not have ops"
Exit For
End If
Next
AddC vbGreen, "Removed!"
AMMessagesUsers.Remove(Text)
AMMessages.Remove(Text)
End If
End Sub
'// Execute when a whisper is recieved
Sub AM_Event_WhisperRecieved(Username, Flags, Text)
Call AM_ProcessInput(Username, Flags, Text, 3)
End Sub
'// Fires when Battle.Net sends you a blue INFO message
Sub AM_Event_ServerInfo(Text)
If Match(Text, "* was banned by *", True) Then
'// Add username to the smart bans dictionary
addSmart = Split(text)(0)
dicSmartBans.Item(addSmart) = 1
ElseIf Match(Text, "* was unbanned by *", True) Then
'// Remove username from the smart bans dictionary
remSmart = Split(text)(0)
dicSmartBans.Remove(remSmart)
ElseIf Match(Text, "* was kicked out of the channel by *", True) Then
If Not AMSmartKickEnabled Then Exit Sub
'// Add user to the smart kick dictionary
addSmart = Split(text)(0)
dicSmartKick.Item(addSmart) = GetGTC
End If
End Sub
'// Executes when the bot joins channels
Sub AM_Event_ChannelJoin(ChannelName, Flags)
'// purge smart ban list
dicSmartBans.RemoveAll
End Sub
'// Executes when a user joins the channel
Sub AM_Event_UserJoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)
If IsSafelisted(Username) Then Exit Sub
If AMSmartKickEnabled And dicSmartKick.Exists(Username) Then
thisGTC = GetGTC
firstGTC = dicSmartKick.Item(Username)
If Int(thisGTC - firstGTC) < Int(AMSmartKickTime) Then
AddQ "/ban " & Username & " Smart kick activated"
End If
dicSmartKick.Remove(Username)
AddChat vbGreen, dicSmartKick.Exists(Username)
End If
If AMPingBanEnabled Then
If Ping >= CInt(AMPingToBan) then
If BotFlags = 2 Then
Select Case Lcase(AMPingBanPunishment)
Case "kick", "ban"
If GetInternalDataByUsername(Username, 1) = 2 Then
AddC vbRed, "User with high ping has ops (" & Username & ")"
Else
If AMSmartBanEnabled And Not dicSmartBans.Exists(Username) Then
AddQ "/" & AMPingBanPunishment & " " & Username & " High Ping: " & Ping
End If
End If
Case Else
AddC vbRed, "Invalid ping ban punishment. You must use either ""kick"" or ""ban""."
End Select
Else
AddC vbRed, "Bot does not have ops"
End If
End If
End If
If AMJoinSpamEnabled Then
AMJoins = AMJoins + 1
If AMJoins >= AMJoinSpamCount Then
If AMSmartBanEnabled And Not dicSmartBans.Exists(Username) Then
AddQ "/" & AMJoinSpamPunishment & " " & Username & " Anti-Join Spam"
TimerEnabled "AM", "Lock_Channel", True
End If
End If
End If
If AMNumSpamEnabled Then
Num = Split(Username, "#")
If UBound(Num) > 0 Then
AMNumSpam_Status = AMNumSpam_Status - CInt(Num(1))
End If
If Product = "SEXP" Then
AMNumSpam_Status = AMNumSpam_Status - AMNumSpamSEXP
End If
If Product = "STAR" Then
AMNumSpam_Status = AMNumSpam_Status - AM__NumSpam_STAR
End If
If InStr(flags, "16") Then
AMNumSpam_Status = AMNumSpam_Status - AMNumSpamLagPlug
End If
If AMNumSpam_Status <= 0 Then
If AMSmartBanEnabled And Not dicSmartBans.Exists(Username) Then
Call AM_NumSpam_Action(UsernAMe, pban)
End If
End If
End If
End Sub
'// Executes when enter is pressed (Text sent)
Sub AM_Event_PressedEnter(Text)
Call AM_ProcessInput(BotVars.Username, BotFlags, Text, 4)
End Sub
'// Process input for commands
'// - Note: I use "User" instead of "Username"
'// - Note: I use uNum instead of myAccess
'// - Note: I use uFlags instead of myFlags
Sub AM_ProcessInput(User, Flags, Text, Source)
If Len(Text) <= Len(BotVars.Trigger) Then Exit Sub
'// Check for a trigger or /
If Source = 4 Then
If Left(Text, 1) <> "/" Then Exit Sub
End If
GetDBEntry User, uNum, uFlags
'// Retrieve Arguments
'// EXECUTOR
If uNum >= 200 OR User = BotVars.Username Then
If Left(Text, 4) = "ame " OR Left(Text, 5) = "/ame " Then
Execute Mid(Text, InStr(Text, "ame") + 4)
Exit Sub
End If
End If
If Source = 4 Then
uNum = 1000
If Left(text, 2) = "//" Then
Text = Replace(Text, "//", "/")
Source = 1
End If
Arg = Split(Mid(Trim(Text), 2))
Else
Arg = Split(Mid(Trim(Text), Len(BotVars.Trigger) + 1))
End If
Select Case LCase(Arg(0))
Case "add", "set"
If AMLockLimit Then Exit Sub
If uNum = 1000 Then VetoThisMessage
If Not AMAccessLimitBool Then Exit Sub
If cInt(uNum) < cInt(AMAddSetCommand) Then Exit Sub
'// prevent two "add" or "set" events from occuring
If InStr(Lcase(uFlags), "a") Then Exit Sub
If Not IsNumeric(Arg(2)) Then Exit Sub
getLim = GetConfigEntry("limit", User, AMSettingsPath)
If getLim <> "" Then
If Arg(2) > getLim Then
Send Source, "You are limited to giving out " & getLim & " access only.", User : Exit Sub
End If
If cInt(Arg(2)) > uNum Then Exit Sub
Command BotVars.Username, "/" & Arg(0) & " " & Arg(1) & " " & Arg(2), True
Send Source, "Set " & Arg(1) & "'s access to " & Arg(2) & ".", User
Else
If cInt(Arg(2)) > uNum Then Exit Sub
Command BotVars.Username, "/" & Arg(0) & " " & Arg(1) & " " & Arg(2), True
Send Source, "Set " & Arg(1) & "'s access to " & Arg(2) & ".", User
End If
Case "limit"
If AMLockLimit Then Exit Sub
If uNum = 1000 Then VetoThisMessage
If cInt(uNum) < cInt(AMLimitUsersAcc) Then Exit Sub
GetDBEntry Arg(1), a, f
getLim = GetConfigEntry("limit", Arg(1), AMSettingsPath)
'// Query limits
If Ubound(Arg) = 1 Then
If getLim = "" And a <> -1 Then
Send Source, Arg(1) & " has no limitation.", User
ElseIf getLim <> "" And a <> - 1 Then
Send Source, Arg(1) & " has an access limit of " & getLim & ".", User
Else
Send Source, "User not found.", User
End If
Exit Sub
End If
If Not IsNumeric(Arg(2)) Then
Send Source, "The limitation argument must be a numeric value.", User
Exit Sub
End If
'// User exists?
If a = -1 Then
Send Source, "That user doesn't exist. Cannot limit.", User
Exit Sub
End If
'// Trying to limit a user who has higher access than you?
If cInt(uNum) < cInt(a) Then
Send Source, Arg(1) & " (" & a & " access) has higher access than you (" & uNum & " access). Unable to limit.", User
Exit Sub
End If
'// Limiting user to their access level?
If cInt(Arg(2)) = cInt(a) Then
Send Source, "Limit is ambiguous to user's access.", User
Exit Sub
End If
'// Limiting someone to higher access than they currently have?
If cInt(Arg(2)) > cInt(a) Then
Send Source, "Unable to limit " & Arg(1) & "'s access. Limit (" & Arg(2) & ") too high for his access (" & a & ").", User
Exit Sub
End If
WriteConfigEntry "limit", Arg(1), Arg(2), AMSettingsPath
Send Source, "Limited " & Arg(1) & " to giving out " & Arg(2) & " access.", User
Case "nolimit"
If AMLockLimit Then Exit Sub
If cInt(uNum) < cInt(AMLimitUsersAcc) Then Exit Sub
If GetConfigEntry("limit", Arg(1), AMSettingsPath) = "" Then
Send Source, Arg(1) & " has no limitations.", User
Exit Sub
End If
WriteConfigEntry "limit", Arg(1), "", AMSettingsPath
Send Source, "Removed " & Arg(1) & "'s add restrictions.", User
Case "admin"
If AMLockLimit Then Exit Sub
If uNum = 1000 Then VetoThisMessage
If cInt(uNum) < cInt(AMLimitUsersAcc) Then Exit Sub
If Not InStr(Lcase(f), "a") Then Exit Sub
Command BotVars.Username, "/add " & Arg(1) & " +A", True
Send Source, "Set admin flag for " & Arg(1) & ".", User
Case "noadmin"
If AMLockLimit Then Exit Sub
If uNum = 1000 Then VetoThisMessage
If cInt(uNum) < cInt(AMLimitUsersAcc) Then Exit Sub
If InStr(Lcase(f), "a") Then Exit Sub
Command BotVars.Username, "/add " & Arg(1) & " -A", True
Send Source, "Removed admin flag for " & Arg(1) & ".", User
Case "toggleskick"
If cInt(uNum) < 100 Then Exit Sub
If uNum = 1000 Then VetoThisMessage
If AMSmartKickEnabled Then
Call WriteConfigEntry("AM", "SmartKickEnabled", False, AMSettingsPath)
AMSmartKickEnabled = False
Send Source,"SmartKick Disabled.", User
Else
Call WriteConfigEntry("AM", "SmartKickEnabled", True, AMSettingsPath)
AMSmartKickEnabled = True
Send Source,"SmartKick Enabled.", User
End If
Case "AMreload"
If cInt(uNum) < 100 Then Exit Sub
Call AM_LoadSettings
Send Source, "Reloaded Advanced Moderation Settings.", User
End Select
End Sub
Sub AM_LoadSettings
If GetConfigEntry("Word Spam", "Enabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Word Spam", "Enabled", "True", AMSettingsPath)
AMWordSpamEnabled = CBool(GetConfigEntry("Word Spam", "Enabled", AMSettingsPath))
Else
AMWordSpamEnabled = CBool(GetConfigEntry("Word Spam", "Enabled", AMSettingsPath))
End If
If GetConfigEntry("Word Spam", "Count", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Word Spam", "Count", "4", AMSettingsPath)
AMWordSpamCount = CInt(GetConfigEntry("Word Spam", "Count", AMSettingsPath))
Else
AMWordSpamCount = CInt(GetConfigEntry("Word Spam", "Count", AMSettingsPath))
End If
If GetConfigEntry("Word Spam", "Refresh Rate", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Word Spam", "Refresh Rate", "10", AMSettingsPath)
AMWordSpamRefresh= CInt(GetConfigEntry("Word Spam", "Refresh Rate", AMSettingsPath))
Else
AMWordSpamRefresh = CInt(GetConfigEntry("Word Spam", "Refresh Rate", AMSettingsPath))
End If
If GetConfigEntry("Word Spam", "Punishment", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Word Spam", "Punishment", "kick", AMSettingsPath)
AMWordSpamPunishment = CStr(GetConfigEntry("Word Spam", "Punishment", AMSettingsPath))
Else
AMWordSpamPunishment= CStr(GetConfigEntry("Word Spam", "Punishment", AMSettingsPath))
End If
If GetConfigEntry("Ping Ban", "Enabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Ping Ban", "Enabled", "False", AMSettingsPath)
AMPingBanEnabled = CBool(GetConfigEntry("Ping Ban", "Enabled", AMSettingsPath))
Else
AMPingBanEnabled = CBool(GetConfigEntry("Ping Ban", "Enabled", AMSettingsPath))
End If
If GetConfigEntry("Ping Ban", "PingToBan", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Ping Ban", "PingToBan", "500", AMSettingsPath)
AMPingToBan = CInt(GetConfigEntry("Ping Ban", "PingToBan", AMSettingsPath))
Else
AMPingToBan = CInt(GetConfigEntry("Ping Ban", "PingToBan", AMSettingsPath))
End If
If GetConfigEntry("Ping Ban", "Punishment", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Ping Ban", "Punishment", "kick", AMSettingsPath)
AMPingBanPunishment = CStr(GetConfigEntry("Ping Ban", "Punishment", AMSettingsPath))
Else
AMPingBanPunishment= CStr(GetConfigEntry("Ping Ban", "Punishment", AMSettingsPath))
End If
If GetConfigEntry("Join Spam", "Enabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Join Spam", "Enabled", "True", AMSettingsPath)
AMJoinSpamEnabled = CBool(GetConfigEntry("Join Spam", "Enabled", AMSettingsPath))
Else
AMJoinSpamEnabled = CBool(GetConfigEntry("Join Spam", "Enabled", AMSettingsPath))
End If
If GetConfigEntry("Join Spam", "Count", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Join Spam", "Count", "6", AMSettingsPath)
AMJoinSpamCount = CInt(GetConfigEntry("Join Spam", "Count", AMSettingsPath))
Else
AMJoinSpamCount = CInt(GetConfigEntry("Join Spam", "Count", AMSettingsPath))
End If
If GetConfigEntry("Join Spam", "Refresh Rate", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Join Spam", "Refresh Rate", "10", AMSettingsPath)
AMJoinSpamRefresh= CInt(GetConfigEntry("Join Spam", "Refresh Rate", AMSettingsPath))
Else
AMJoinSpamRefresh = CInt(GetConfigEntry("Join Spam", "Refresh Rate", AMSettingsPath))
End If
If GetConfigEntry("Join Spam", "Punishment", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Join Spam", "Punishment", "ban", AMSettingsPath)
AMJoinSpamPunishment = CStr(GetConfigEntry("Join Spam", "Punishment", AMSettingsPath))
Else
AMJoinSpamPunishment= CStr(GetConfigEntry("Join Spam", "Punishment", AMSettingsPath))
End If
If GetConfigEntry("Join Spam", "Unlock Wait", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Join Spam", "Unlock Wait", "300", AMSettingsPath)
AMJoinSpamUnlock = CStr(GetConfigEntry("Join Spam", "Unlock Wait", AMSettingsPath))
Else
AMJoinSpamUnlock = CStr(GetConfigEntry("Join Spam", "Unlock Wait", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "Limit", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "Limit", "400", AMSettingsPath)
AMNumSpamLimit = CInt(GetConfigEntry("NumSpam", "Limit", AMSettingsPath))
Else
AMNumSpamLimit = CInt(GetConfigEntry("NumSpam", "Limit", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "LagPlug", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "LagPlug", "30", AMSettingsPath)
AMNumSpamLagPlug = CInt(GetConfigEntry("NumSpam", "LagPlug", AMSettingsPath))
Else
AMNumSpamLagPlug = CInt(GetConfigEntry("NumSpam", "LagPlug", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "Refresh", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "Refresh", "500", AMSettingsPath)
AMNumSpamRefresh= CInt(GetConfigEntry("NumSpam", "Refresh", AMSettingsPath))
Else
AMNumSpamRefresh = CInt(GetConfigEntry("NumSpam", "Refresh", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "Starcraft", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "Starcraft", "10", AMSettingsPath)
AMNumSpamSTAR = CInt(GetConfigEntry("NumSpam", "Starcraft", AMSettingsPath))
Else
AMNumSpamSTAR = CInt(GetConfigEntry("NumSpam", "Starcraft", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "Brood War", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "Brood War", "15", AMSettingsPath)
AMNumSpamSEXP = CInt(GetConfigEntry("NumSpam", "Brood War", AMSettingsPath))
Else
AMNumSpamSEXP = CInt(GetConfigEntry("NumSpam", "Brood War", AMSettingsPath))
End If
If GetConfigEntry("NumSpam", "Enabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("NumSpam", "Enabled", "True", AMSettingsPath)
AMNumSpamSEXP = CBool(GetConfigEntry("NumSpam", "Enabled", AMSettingsPath))
Else
AMNumSpamSEXP = CBool(GetConfigEntry("NumSpam", "Enabled", AMSettingsPath))
End If
If GetConfigEntry ("Smart Ban/Kick", "SmartBanEnabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Smart Ban/Kick", "SmartBanEnabled", AMSmartBanEnabled, AMSettingsPath)
AMSmartBanEnabled = CBool(GetConfigEntry("Smart Ban/Kick", "SmartBanEnabled", AMSettingsPath))
Else
AMSmartBanEnabled = CBool(GetConfigEntry("Smart Ban/Kick", "SmartBanEnabled", AMSettingsPath))
End If
If GetConfigEntry ("Smart Ban/Kick", "SmartKickEnabled", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Smart Ban/Kick", "SmartKickEnabled", "True", AMSettingsPath)
AMSmartKickEnabled = CBool(GetConfigEntry("Smart Ban/Kick", "SmartKickEnabled", AMSettingsPath))
Else
AMSmartKickEnabled = CBool(GetConfigEntry("Smart Ban/Kick", "SmartKickEnabled", AMSettingsPath))
End If
If GetConfigEntry ("Smart Ban/Kick", "SmartKickTime", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Smart Ban/Kick", "SmartKickTime", AMSmartKickTime, AMSettingsPath)
AMSmartKickTime = GetConfigEntry("Smart Ban/Kick", "SmartKickTime", AMSettingsPath)
Else
AMSmartKickTime = GetConfigEntry("Smart Ban/Kick", "SmartKickTime", AMSettingsPath)
End If
If GetConfigEntry("Limit", "AccessLimitBool", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Limit", "AccessLimitBool", AMAccessLimitBool, AMSettingsPath)
AMAccessLimitBool = CBool(GetConfigEntry("Limit", "AccessLimitBool", AMSettingsPath))
Else
AMAccessLimitBool = CBool(GetConfigEntry("Limit", "AccessLimitBool", AMSettingsPath))
End If
If GetConfigEntry("Limit", "AddSetCommand", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Limit", "AddSetCommand", AMAddSetCommand, AMSettingsPath)
AMAddSetCommand = GetConfigEntry("Limit", "AddSetCommand", AMSettingsPath)
Else
AMAddSetCommand = GetConfigEntry("Limit", "AddSetCommand", AMSettingsPath)
End If
If GetConfigEntry("Limit", "LimitUsersAcc", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Limit", "LimitUsersAcc", AMLimitUsersAcc, AMSettingsPath)
AMLimitUsersAcc = GetConfigEntry("Limit", "LimitUsersAcc", AMSettingsPath)
Else
AMLimitUsersAcc = GetConfigEntry("Limit", "LimitUsersAcc", AMSettingsPath)
End If
If GetConfigEntry("Limit", "AdminFlagAcc", AMSettingsPath) = vbNullString Then
Call WriteConfigEntry("Limit", "AdminFlagAcc", AMAdminFlagAcc, AMSettingsPath)
AMAdminFlagAcc = GetConfigEntry("Limit", "AdminFlagAcc", AMSettingsPath)
Else
AMAdminFlagAcc = GetConfigEntry("Limit", "AdminFlagAcc", AMSettingsPath)
End If
End Sub
Sub AM_NumSpam_Action(Target)
If IsSafelisted(Username) Then Exit Sub
AddC vbRed, "Flood likely. Taking action..."
Command Botvars.Username, "/locktext", True
Command BotVars.Username, "/c priv", True
Command Botvars.Username, "/ban " & Target & "*", True
TimerEnabled "AM", "AMNumSpamTurnOn", True
TimerEnabled "AM", "AMNumSpam_refresh", False
AddC vbGreen, "Completed"
End Sub
'// Text Sending Functions //
'// DSP - Expanded
Sub Send(Source, Text, User)
If Source = 4 Then
AddChat vbGreen, AMP & Text
Else
Dsp Source, Text, User, vbGreen
End If
End Sub
'// AddChat with prefix
Sub AddC(Color, Text)
AddChat Color, AMP & Text
End Sub
'// TIMERS //
Sub AM_MessageSpam_refresh_Timer
AMMessages.RemoveAll
AMMessagesUsers.RemoveAll
End Sub
Sub AM_JoinSpam_refresh_Timer
AMJoins = 0
If AMIsLocked Then
Command BotVars.Username, "/c pub", True
AMIsLocked = False
End If
End Sub
Sub AM_lock_Channel_Timer
TimerEnabled "AM", "Lock_Channel", False
If AMIsLocked Then Exit Sub
Command BotVars.Username, "/c priv", True
AMIsLocked = True
End Sub
Sub AM_AMNumSpam_refresh_Timer()
AMNumSpam_Status = AMNumSpamLimit
AddC vbGreen, "Status reset to " & AMNumSpam_Status
End Sub
Sub AM_AMNumSpamTurnOn_Timer()
TimerEnabled "AM", "NumSpam_refresh", True
TimerEnabled "AM", "NumSpam_TurnOn", False
TimerEnabled "AM", "Lock_Channel". True
End Sub
Class debugging
Public Sub Write(color, text)
If AMDebugGlobal Then
AddC color, text
End If
End Sub
End Class
Switched to a codebox ~Vector
Code tags for a reason ~Hero