lcox74 / snailrace

A fun discord bot where you can race snails against other members.
0 stars 0 forks source link

Style Refactor #27

Open lcox74 opened 1 year ago

lcox74 commented 1 year ago

Currently there is no consistent style or abstraction for messages. This needs to be rectified by abstracting all discord response styles to a sub-library located /pkg/styles. These abstractions include, but aren't limited too:


// Colours for Embeds
const (
    ColourOk     int = 0x2ECC71 // Green
    ColourInfo   int = 0x3498DB // Blue
    ColourError  int = 0xE74C3C // Red
)

// Error Messages
func RespondErr(session *discordgo.Session, interaction *discordgo.Interaction, ephemeral bool, msg string)
func SendErr(session *discordgo.Session, msg string) *discordgo.Message
func EditErr(session *discordgo.Session, original *discordgo.Message, msg string)

// Ok Messages (The following also make the Info equivalent) 
func RespondOk(session *discordgo.Session, interaction *discordgo.Interaction, ephemeral bool, title string, msg string)
func RespondOkComponents(session *discordgo.Session, interaction *discordgo.Interaction, ephemeral bool, title string, msg string, components []discordgo.MessageComponent)

func SendOk(session *discordgo.Session, title string, msg string) *discordgo.Message
func SendOkComponents(session *discordgo.Session, title string, msg string, components []discordgo.MessageComponent) *discordgo.Message

func EditOk(session *discordgo.Session, original *discordgo.Message, title string, msg string)
func EditOkComponents(session *discordgo.Session, original *discordgo.Message, title string, msg string, components []discordgo.MessageComponent)

This will also require the full refactor of all messages sent to use this.