Features: Add admin override for markdown info auto-cleanup.

master
Marc Egerton 2020-05-08 06:29:08 +01:00
parent 759eb07e40
commit 54ea3b3c4e
1 changed files with 19 additions and 8 deletions

View File

@ -140,6 +140,15 @@ func (f *Features) handleHelp(s *discordgo.Session, m *discordgo.MessageCreate)
} }
func (f *Features) handleMarkdownInfo(s *discordgo.Session, m *discordgo.MessageCreate) error { func (f *Features) handleMarkdownInfo(s *discordgo.Session, m *discordgo.MessageCreate) error {
cleanup := true
args := strings.Split(m.Content, " ")
if len(args) == 2 {
if args[1] == "stay" && f.Auth.CheckAdminRole(m.Member) {
cleanup = false
}
}
desc := "*Italic* text goes between `*single asterisks*`\n" desc := "*Italic* text goes between `*single asterisks*`\n"
desc += "**Bold** text goes between `**double asterisks**`\n" desc += "**Bold** text goes between `**double asterisks**`\n"
desc += "***Bold and Italic*** text goes between `***triple asterisks***`\n" desc += "***Bold and Italic*** text goes between `***triple asterisks***`\n"
@ -159,6 +168,7 @@ func (f *Features) handleMarkdownInfo(s *discordgo.Session, m *discordgo.Message
return err return err
} }
if cleanup {
time.Sleep(15 * time.Second) time.Sleep(15 * time.Second)
err = s.ChannelMessageDelete(m.ChannelID, r.ID) err = s.ChannelMessageDelete(m.ChannelID, r.ID)
@ -169,6 +179,7 @@ func (f *Features) handleMarkdownInfo(s *discordgo.Session, m *discordgo.Message
if err != nil { if err != nil {
return err return err
} }
}
return nil return nil
} }