diff options
author | Jordan <me@jordan.im> | 2021-12-08 21:29:38 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2021-12-08 21:29:38 -0700 |
commit | 1cfdfd841155ccca925262a040dd879e6e98b89b (patch) | |
tree | b1b3b6778bbe2d58b8a64cc343b4e3ccd595bff3 | |
parent | 3f0aaeb92320114a5ed66edcdb5b4e1124a2f918 (diff) | |
download | keep-1cfdfd841155ccca925262a040dd879e6e98b89b.tar.gz keep-1cfdfd841155ccca925262a040dd879e6e98b89b.zip |
keep: ensure non-zero chanMsgs before assignment
-rw-r--r-- | keep.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -147,8 +147,10 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { log.Printf("Unable to get messages: %s", err) return } - m.Content = chanMsgs[0].Content - m.Attachments = chanMsgs[0].Attachments + if len(chanMsgs) > 0 { + m.Content = chanMsgs[0].Content + m.Attachments = chanMsgs[0].Attachments + } } // Log all messages if verbose set to true |