Skip to content

Commit

Permalink
adding -raw flag (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
savage4618 authored Feb 19, 2025
1 parent 26081fb commit 876fda0
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions stdcommands/roast/roast.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
}

0 comments on commit 876fda0

Please sign in to comment.