diff --git a/config.go b/config.go index 08bb8bf..870eb15 100644 --- a/config.go +++ b/config.go @@ -59,6 +59,7 @@ func saveConfig() { } func adminInteraction(s *discordgo.Session, m string) { + defer log.PanicSafe() admin, _ := s.GuildMember(config.GuildID, m) counter, ok := config.Stats[admin.User.ID] if !ok { @@ -69,6 +70,18 @@ func adminInteraction(s *discordgo.Session, m string) { } +func activeInteraction(s *discordgo.Session, m string) { + defer log.PanicSafe() + user, _ := s.GuildMember(config.GuildID, m) + counter, ok := config.Stats[user.User.ID] + if !ok { + config.Activity[user.User.ID] = 1 + } else { + config.Activity[user.User.ID] = counter + 1 + } + +} + func rebootBump() { time.Sleep(time.Until(config.BumpTime.Add(2 * time.Hour))) dg.ChannelMessageSend(config.AdminChannel, "!d bump is ready") diff --git a/discordMessage.go b/discordMessage.go index 020aa39..76bd09b 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -29,12 +29,16 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { if m.ChannelID != config.AdminChannel { lastActiveChan = m.ChannelID lastActiveTime = time.Now() + if len(m.Attachments) > 0 { + activeInteraction(s, m.Author.ID) + } } if strings.HasPrefix(m.Content, "!d bump") { if time.Since(config.BumpTime) < 2*time.Hour { s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("Sorry, <@%+v> already claimed the bump. Better luck next time!", config.LastBumper)) return } + activeInteraction(s, m.Author.ID) config.LastBumper = m.Author.ID go bumpTimer(s) return diff --git a/types.go b/types.go index e053b68..076cb6e 100644 --- a/types.go +++ b/types.go @@ -36,6 +36,7 @@ type Config struct { BumpTime time.Time LastBumper string Stats map[string]int + Activity map[string]int Unverified map[string]time.Time Verifications map[string]Verification Probations map[string]time.Time