diff --git a/discordMessage.go b/discordMessage.go index 1a7d510..fd854db 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -11,6 +11,10 @@ import ( func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { defer log.PanicSafe() + if m.GuildID == "" { + handlePM(s, m) + return + } if m.Author.ID == "302050872383242240" && len(m.Embeds) > 0 && strings.Contains(m.Embeds[0].Description, "minutes until the server can be bumped") { log.LogDebug("Failed bump detected") re := regexp.MustCompile("Please wait another (.*) minutes until the server can be bumped") @@ -22,22 +26,21 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { Parts: strings.Split(m.Content, " ")[2:], }) } - if m.Author.ID == s.State.User.ID || m.Author.Bot { + if m.Author.Bot { return } - if m.GuildID == "" { - handlePM(s, m) - return + + if isAdmin(m.Member) { + adminInteraction(s, m.Author.ID) } - if m.ChannelID == config.MonitorChann { + + if m.ChannelID == config.MonitorChann && !isAdmin(m.Member) { if strings.Contains(m.Content, "erif") && !m.Author.Bot { s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v send me a private message for verification.", m.Author.Mention())) } return } - if isAdmin(m.Member) { - adminInteraction(s, m.Author.ID) - } + if m.ChannelID != config.AdminChannel { lastActiveChan = m.ChannelID lastActiveTime = time.Now()