#Adding delay to auto reply weak aura

12 messages · Page 1 of 1 (latest)

deft palm
#
    if event=="CHAT_MSG_WHISPER" and message and aura_env then
        if not aura_env.last or aura_env.last < GetTime() - 1 then
            aura_env.last = GetTime()
            message=string.lower(message)
            sender=Ambiguate(sender,"short")
            local needle = nil
            
            for _,row in pairs(aura_env.config.MessageKeys) do
                if not needle and row.enabled then
                    needle = message:match("%f[%p%w]"..string.lower(row.keyword).."%f[%W]")
                    if needle then
                        SendChatMessage(row.message, "WHISPER", "COMMON", sender)
                    end
                end
            end
            
        end
    end
    
end```
Looking to add a delay of 2ish seconds to this weak aura that auto replies instantly
earnest rapids
#

I deleted your crosspost for you.

worn arrow
#

Delay 2 sec? Replace SendChatMessage(row.message, "WHISPER", "COMMON", sender) with:

C_Timer.After(2, function()
  SendChatMessage(row.message, "WHISPER", "COMMON", sender)
end)
ashen crag
#

look at snippets in custom code input screen there is a snippet for basic throttle

#

unless you want a 2 sec delay on the reply

worn arrow
#

I thought the same but there's already a throttle.

ashen crag
#

I didn't even look at the code tbh

worn arrow
#

The thing that's perhaps actually wanted is for messages to come in unthrottled but go out at a limited rate. That would be more complex. You'd table up the entries as they come in and throttle the outgoings, with a C_Timer and ScanEvent to refire.

ashen crag
#

possibly. does blizz throttle your reply speed?

worn arrow
#

It does, but messages are lost, not queued.

deft palm