Open Woovie opened 5 years ago
Solution:
time
packageconst luaPingDuration = 5 * 60 * time.Second
time.Time
, named something like lastLuaPing
lastLuaPing
to time.Now()
whenever ping happens(time.Now() - b.lastLuaPing) > luaPingDuration
?Should frequency be per channel? I think so.
In that case you can replace b.lastLuaPing
with a lastLuaPings map[string]time.Time
. The zero value for time.Time
is just epoch 0, so you don't need to do any initalisation checks for entries. Just initialise lastLuaPings
using make(map[string]time.Time)
and you can use any key of the map straight away.
Keys can be a ChannelID from the event struct.
ℹ️Details Sometimes IggyStats can spit out the "It's Lua not LUA" message a bit too much and it annoys end users.
️⃣Step-by-Step Instructions
Type LUA in multiple messages in short recession in a Discord room where the bot is active.
❓Suggested Resolution / Expected Behavior We should limit the frequency this message is sent.
✅Known workaround(s) Don't type LUA