more debug
This commit is contained in:
parent
45b4ec7302
commit
01ba7fafc1
|
@ -67,6 +67,7 @@ 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")
|
app.limiter.LogInteraction(m.Author.ID, "messagecreate")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,15 @@ If it is in the limit, then count. If the amount of interactions is higher than
|
||||||
type Limiter struct {
|
type Limiter struct {
|
||||||
TimeLimit time.Duration
|
TimeLimit time.Duration
|
||||||
RateLimit int
|
RateLimit int
|
||||||
Logs map[string][]Action
|
Logs map[string][]*Action
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Limiter) LogInteraction(userid string, action string) {
|
func (l *Limiter) LogInteraction(userid string, action string) {
|
||||||
l.Logs[userid] = append(l.Logs[userid], Action{
|
ac := &Action{
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now(),
|
||||||
Type: action,
|
Type: action,
|
||||||
})
|
}
|
||||||
|
l.Logs[userid] = append(l.Logs[userid], ac)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CheckAllowed counts the amount of log entries for a given userid, making sure to delete and not count the expired ones.
|
/* CheckAllowed counts the amount of log entries for a given userid, making sure to delete and not count the expired ones.
|
||||||
|
|
Loading…
Reference in New Issue