From 876fda09b5f14141b93d42f2dfcf4ee01004ecf1 Mon Sep 17 00:00:00 2001 From: savage4618 Date: Wed, 19 Feb 2025 02:17:42 -0500 Subject: [PATCH] adding -raw flag (#1842) --- stdcommands/roast/roast.go | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/stdcommands/roast/roast.go b/stdcommands/roast/roast.go index 5cb12403a..a10748bee 100644 --- a/stdcommands/roast/roast.go +++ b/stdcommands/roast/roast.go @@ -19,21 +19,29 @@ var Command = &commands.YAGCommand{ }, DefaultEnabled: true, SlashCommandEnabled: true, + ArgSwitches: []*dcmd.ArgDef{ + {Name: "raw", Help: "Raw roast output, no embed"}, + }, RunFunc: func(data *dcmd.Data) (interface{}, error) { roast := html.UnescapeString(randomRoast()) - embed := &discordgo.MessageEmbed{ - Title: data.Author.Username + " roasted ", - Footer: &discordgo.MessageEmbedFooter {Text: "Boom, roasted!"}, - } - if arg0 := data.Args[0].Value; arg0 != nil { - target := arg0.(*discordgo.User) - embed.Title += target.Username - embed.Description = fmt.Sprintf(`## Hey %s, %s`, target.Mention(), roast) + + if data.Switches["raw"].Value != nil && data.Switches["raw"].Value.(bool) { + return roast, nil } else { - embed.Title += "a random person nearby" - embed.Description = "## " + roast - } + embed := &discordgo.MessageEmbed{ + Title: data.Author.Username + " roasted ", + Footer: &discordgo.MessageEmbedFooter{Text: "Boom, roasted!"}, + } + if arg0 := data.Args[0].Value; arg0 != nil { + target := arg0.(*discordgo.User) + embed.Title += target.Username + embed.Description = fmt.Sprintf(`## Hey %s, %s`, target.Mention(), roast) + } else { + embed.Title += "a random person nearby" + embed.Description = "## " + roast + } - return embed, nil + return embed, nil + } }, }