Implement message throttling for whispers
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -212,7 +212,7 @@ for i, part in ipairs(stinkies) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local killSpamTime = 30
|
local killSpamTime = 10
|
||||||
local recentlyKilled = {}
|
local recentlyKilled = {}
|
||||||
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
||||||
if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then
|
if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then
|
||||||
@@ -238,14 +238,18 @@ aura_env.localStinkies = {}
|
|||||||
---@param name string
|
---@param name string
|
||||||
aura_env.StinkyDetected = function(name)
|
aura_env.StinkyDetected = function(name)
|
||||||
if aura_env.config.debug then print(string.format("StinkyDetected (%s)", name)) end
|
if aura_env.config.debug then print(string.format("StinkyDetected (%s)", name)) end
|
||||||
|
local stinky = aura_env.stinkies[name]
|
||||||
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
||||||
GetTime() - aura_env.config.messageThrottle then
|
GetTime() - aura_env.config.messageThrottle then
|
||||||
local stinky = aura_env.stinkies[name]
|
|
||||||
Message.QueueNotifyGuild(stinky)
|
Message.QueueNotifyGuild(stinky)
|
||||||
Message.QueueNotifyWhisper(stinky)
|
Message.QueueNotifyWhisper(stinky)
|
||||||
|
end
|
||||||
|
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
||||||
|
GetTime() - aura_env.config.messageThrottleAddon then
|
||||||
Message.QueueNotifyAddonGuild(stinky)
|
Message.QueueNotifyAddonGuild(stinky)
|
||||||
Message.QueueNotifyAddonWhisper(stinky)
|
Message.QueueNotifyAddonWhisper(stinky)
|
||||||
end
|
end
|
||||||
|
WeakAuras.ScanEvents("CHAT_MSG_ADDON", aura_env.addonprefix, stinky:FormAddonMessage())
|
||||||
aura_env.localStinkies[name] = GetTime()
|
aura_env.localStinkies[name] = GetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user