qaisjp / mtabot

Discord bot
5 stars 0 forks source link

LUA message frequency should be time-limited #2

Open Woovie opened 5 years ago

Woovie commented 5 years ago

ℹ️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

qaisjp commented 5 years ago

Solution:

Woovie commented 5 years ago

Should frequency be per channel? I think so.

qaisjp commented 5 years ago

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.