forked from pothtonswer/discordmuffin
Added .MessageFormat() to emoji struct (#569)
* Added .ChatName() to emoji struct * Renamed ChatName to MessageFormat * Fix lint
This commit is contained in:
parent
d6e795c573
commit
1593c55523
1 changed files with 13 additions and 0 deletions
13
structs.go
13
structs.go
|
@ -281,6 +281,19 @@ type Emoji struct {
|
||||||
Animated bool `json:"animated"`
|
Animated bool `json:"animated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MessageFormat returns a correctly formatted Emoji for use in Message content and embeds
|
||||||
|
func (e *Emoji) MessageFormat() string {
|
||||||
|
if e.ID != "" && e.Name != "" {
|
||||||
|
if e.Animated {
|
||||||
|
return "<a:" + e.APIName() + ">"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<:" + e.APIName() + ">"
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.APIName()
|
||||||
|
}
|
||||||
|
|
||||||
// APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
|
// APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
|
||||||
func (e *Emoji) APIName() string {
|
func (e *Emoji) APIName() string {
|
||||||
if e.ID != "" && e.Name != "" {
|
if e.ID != "" && e.Name != "" {
|
||||||
|
|
Loading…
Reference in a new issue