Optimized some structs to reduce their runtime size.

This commit is contained in:
Bruce Marriner 2016-01-28 11:10:12 -06:00
parent edc09778a7
commit 9b8e880744
2 changed files with 26 additions and 26 deletions

View file

@ -17,16 +17,16 @@ import (
// A Message stores all data related to a specific Discord message. // A Message stores all data related to a specific Discord message.
type Message struct { type Message struct {
ID string `json:"id"` ID string `json:"id"`
Author *User `json:"author"`
Content string `json:"content"`
Attachments []*Attachment `json:"attachments"`
Tts bool `json:"tts"`
Embeds []*Embed `json:"embeds"`
Timestamp string `json:"timestamp"`
MentionEveryone bool `json:"mention_everyone"`
EditedTimestamp string `json:"edited_timestamp"`
Mentions []*User `json:"mentions"`
ChannelID string `json:"channel_id"` ChannelID string `json:"channel_id"`
Content string `json:"content"`
Timestamp string `json:"timestamp"`
EditedTimestamp string `json:"edited_timestamp"`
Tts bool `json:"tts"`
MentionEveryone bool `json:"mention_everyone"`
Author *User `json:"author"`
Attachments []*Attachment `json:"attachments"`
Embeds []*Embed `json:"embeds"`
Mentions []*User `json:"mentions"`
} }
// An Attachment stores data for message attachments. // An Attachment stores data for message attachments.

View file

@ -115,17 +115,17 @@ type ICEServer struct {
// A Invite stores all data related to a specific Discord Guild or Channel invite. // A Invite stores all data related to a specific Discord Guild or Channel invite.
type Invite struct { type Invite struct {
MaxAge int `json:"max_age"`
Code string `json:"code"`
Guild *Guild `json:"guild"` Guild *Guild `json:"guild"`
Revoked bool `json:"revoked"` Channel *Channel `json:"channel"`
Inviter *User `json:"inviter"`
Code string `json:"code"`
CreatedAt string `json:"created_at"` // TODO make timestamp CreatedAt string `json:"created_at"` // TODO make timestamp
Temporary bool `json:"temporary"` MaxAge int `json:"max_age"`
Uses int `json:"uses"` Uses int `json:"uses"`
MaxUses int `json:"max_uses"` MaxUses int `json:"max_uses"`
Inviter *User `json:"inviter"`
XkcdPass bool `json:"xkcdpass"` XkcdPass bool `json:"xkcdpass"`
Channel *Channel `json:"channel"` Revoked bool `json:"revoked"`
Temporary bool `json:"temporary"`
} }
// A Channel holds all data related to an individual Discord channel. // A Channel holds all data related to an individual Discord channel.
@ -153,11 +153,11 @@ type PermissionOverwrite struct {
// Emoji struct holds data related to Emoji's // Emoji struct holds data related to Emoji's
type Emoji struct { type Emoji struct {
Roles []string `json:"roles"`
RequireColons bool `json:"require_colons"`
Name string `json:"name"`
Managed bool `json:"managed"`
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"`
Roles []string `json:"roles"`
Managed bool `json:"managed"`
RequireColons bool `json:"require_colons"`
} }
// A Guild holds all data related to a specific Discord Guild. Guilds are also // A Guild holds all data related to a specific Discord Guild. Guilds are also
@ -167,14 +167,14 @@ type Guild struct {
Name string `json:"name"` Name string `json:"name"`
Icon string `json:"icon"` Icon string `json:"icon"`
Region string `json:"region"` Region string `json:"region"`
AfkTimeout int `json:"afk_timeout"`
AfkChannelID string `json:"afk_channel_id"` AfkChannelID string `json:"afk_channel_id"`
EmbedChannelID string `json:"embed_channel_id"` EmbedChannelID string `json:"embed_channel_id"`
EmbedEnabled bool `json:"embed_enabled"`
OwnerID string `json:"owner_id"` OwnerID string `json:"owner_id"`
Large bool `json:"large"` // ??
JoinedAt string `json:"joined_at"` // make this a timestamp JoinedAt string `json:"joined_at"` // make this a timestamp
Splash string `json:"splash"` Splash string `json:"splash"`
AfkTimeout int `json:"afk_timeout"`
EmbedEnabled bool `json:"embed_enabled"`
Large bool `json:"large"` // ??
Roles []*Role `json:"roles"` Roles []*Role `json:"roles"`
Emojis []*Emoji `json:"emojis"` Emojis []*Emoji `json:"emojis"`
Members []*Member `json:"members"` Members []*Member `json:"members"`
@ -188,8 +188,8 @@ type Role struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Managed bool `json:"managed"` Managed bool `json:"managed"`
Color int `json:"color"`
Hoist bool `json:"hoist"` Hoist bool `json:"hoist"`
Color int `json:"color"`
Position int `json:"position"` Position int `json:"position"`
Permissions int `json:"permissions"` Permissions int `json:"permissions"`
} }
@ -197,13 +197,13 @@ type Role struct {
// A VoiceState stores the voice states of Guilds // A VoiceState stores the voice states of Guilds
type VoiceState struct { type VoiceState struct {
UserID string `json:"user_id"` UserID string `json:"user_id"`
Suppress bool `json:"suppress"`
SessionID string `json:"session_id"` SessionID string `json:"session_id"`
ChannelID string `json:"channel_id"`
Suppress bool `json:"suppress"`
SelfMute bool `json:"self_mute"` SelfMute bool `json:"self_mute"`
SelfDeaf bool `json:"self_deaf"` SelfDeaf bool `json:"self_deaf"`
Mute bool `json:"mute"` Mute bool `json:"mute"`
Deaf bool `json:"deaf"` Deaf bool `json:"deaf"`
ChannelID string `json:"channel_id"`
} }
// A Presence stores the online, offline, or idle and game status of Guild members. // A Presence stores the online, offline, or idle and game status of Guild members.
@ -254,8 +254,8 @@ type Settings struct {
InlineEmbedMedia bool `json:"inline_embed_media"` InlineEmbedMedia bool `json:"inline_embed_media"`
EnableTtsCommand bool `json:"enable_tts_command"` EnableTtsCommand bool `json:"enable_tts_command"`
MessageDisplayCompact bool `json:"message_display_compact"` MessageDisplayCompact bool `json:"message_display_compact"`
Locale string `json:"locale"`
ShowCurrentGame bool `json:"show_current_game"` ShowCurrentGame bool `json:"show_current_game"`
Locale string `json:"locale"`
Theme string `json:"theme"` Theme string `json:"theme"`
MutedChannels []string `json:"muted_channels"` MutedChannels []string `json:"muted_channels"`
} }