From 5af2a60c28c1ae787b31e07edc02442be57a7b33 Mon Sep 17 00:00:00 2001 From: Daniel Underwood Date: Tue, 1 Mar 2022 20:37:21 -0500 Subject: [PATCH] Refactor: Move discord structs to separate file --- discord.go | 28 ++++++++++++++++++++++++++++ main.go | 27 --------------------------- 2 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 discord.go diff --git a/discord.go b/discord.go new file mode 100644 index 0000000..c976e70 --- /dev/null +++ b/discord.go @@ -0,0 +1,28 @@ +package main + +type Author struct { + Name string `json:"name"` +} + +type Provider struct { + Name string `json:"name"` +} + +type Field struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// https://discord.com/developers/docs/resources/channel#embed-object +type Embed struct { + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Author Author `json:"author,omitempty"` + Provider Provider `json:"provider,omitempty"` + Fields []Field `json:"fields,omitempty"` +} + +type DiscordMessage struct { + Content string `json:"content,omitempty"` + Embeds []Embed `json:"embeds,omitempty"` +} diff --git a/main.go b/main.go index 04266f4..d4c9950 100644 --- a/main.go +++ b/main.go @@ -13,33 +13,6 @@ import ( "github.com/nxadm/tail" ) -type Author struct { - Name string `json:"name"` -} - -type Provider struct { - Name string `json:"name"` -} - -type Field struct { - Name string `json:"name"` - Value string `json:"value"` -} - -// https://discord.com/developers/docs/resources/channel#embed-object -type Embed struct { - Title string `json:"title,omitempty"` - Description string `json:"description,omitempty"` - Author Author `json:"author,omitempty"` - Provider Provider `json:"provider,omitempty"` - Fields []Field `json:"fields,omitempty"` -} - -type DiscordMessage struct { - Content string `json:"content,omitempty"` - Embeds []Embed `json:"embeds,omitempty"` -} - func main() { var file, expression, url, sourceName string flag.StringVar(&file, "file", "", "File to read. Required")