Skip to content

Commit

Permalink
Refactor: Move discord structs to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
danielunderwood committed Mar 2, 2022
1 parent a7df7f8 commit 5af2a60
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
28 changes: 28 additions & 0 deletions discord.go
Original file line number Diff line number Diff line change
@@ -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"`
}
27 changes: 0 additions & 27 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 5af2a60

Please sign in to comment.