diff --git a/discordMessage.go b/discordMessage.go index 9f03dc6..06e836f 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -23,6 +23,22 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { } return } + if isAdmin(m.Member) { + adminInteraction(s, m.Author.ID) + } + if m.ChannelID != config.AdminChannel { + lastActiveChan = m.ChannelID + lastActiveTime = time.Now() + } + 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 + } + config.LastBumper = m.Author.ID + go bumpTimer(s) + return + } if strings.Contains(m.Content, s.State.User.ID) { b := BotCommand{ Session: s, @@ -63,22 +79,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v please say \"!d bump\" without the quotes to bump our server :)", m.Author.Mention())) } } - if isAdmin(m.Member) { - adminInteraction(s, m.Author.ID) - } - if m.ChannelID != config.AdminChannel { - lastActiveChan = m.ChannelID - lastActiveTime = time.Now() - } - 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 - } - config.LastBumper = m.Author.ID - go bumpTimer(s) - return - } + } func handlePM(s *discordgo.Session, m *discordgo.MessageCreate) {