fixed nil map error

This commit is contained in:
DutchEllie 2021-05-31 11:21:30 +02:00
parent 01ba7fafc1
commit 6ed12b7e83
2 changed files with 3 additions and 3 deletions

View File

@ -10,6 +10,8 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message
if m.Author.Bot { if m.Author.Bot {
return return
} }
app.infoLog.Printf("Adding entry\n")
app.limiter.LogInteraction(m.Author.ID, "messagecreate")
/* Check if the user is even allowed by the rate limiter */ /* Check if the user is even allowed by the rate limiter */
err := app.limiter.CheckAllowed(m.Author.ID) err := app.limiter.CheckAllowed(m.Author.ID)
@ -67,7 +69,4 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message
app.findTrigger(s, m) app.findTrigger(s, m)
} }
app.infoLog.Printf("Adding entry\n")
app.limiter.LogInteraction(m.Author.ID, "messagecreate")
} }

View File

@ -45,6 +45,7 @@ func main() {
limiter := &limiter.Limiter{ limiter := &limiter.Limiter{
RateLimit: 5, RateLimit: 5,
TimeLimit: time.Second * 15, TimeLimit: time.Second * 15,
Logs: make(map[string][]*limiter.Action),
} }
app := &application{ app := &application{