From 021cbee40a7f023a876399d8347a38334a191293 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 13 Oct 2020 09:31:13 -0400 Subject: [PATCH] meme: add extra split for discord --- plugins/meme/meme.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/meme/meme.go b/plugins/meme/meme.go index c8f4b1a..08a36d7 100644 --- a/plugins/meme/meme.go +++ b/plugins/meme/meme.go @@ -91,7 +91,7 @@ func (p *MemePlugin) help(c bot.Connector, kind bot.Kind, message msg.Message, a msg += "\n`[format]` can be a URL" msg += fmt.Sprintf("\nor a format from the list of %d pre-made memes listed on the website", len(formats)) msg += fmt.Sprintf("\nHead over to %s/meme to view and add new meme formats", webRoot) - msg += "\nYou can use `_` as a placeholder for empty text and a newline to separate top vs bottom." + msg += "\nYou can use `_` as a placeholder for empty text and a newline (|| on Discord) to separate top vs bottom." p.bot.Send(c, bot.Message, message.Channel, msg) return true } @@ -263,7 +263,11 @@ func (p *MemePlugin) sendMeme(c bot.Connector, channel, channelName, msgID strin go func() { top, bottom := "", message - parts = strings.Split(message, "\n") + if strings.Contains(message, "||") { + parts = strings.Split(message, "||") + } else { + parts = strings.Split(message, "\n") + } if len(parts) > 1 { top, bottom = parts[0], parts[1] }