Browse Source

Cleaning up/Happy path

master
Gregory Rudolph 3 years ago
parent
commit
62738d8a88
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 33
      discordMessage.go

33
discordMessage.go

@ -23,6 +23,22 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { @@ -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) { @@ -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) {

Loading…
Cancel
Save