Discord: Fixed Emoji.APIString() mishandling Unicode characters

This commit is contained in:
diamondburned (Forefront) 2020-05-14 00:49:10 -07:00
parent c4504808a2
commit aa07ff9a43
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ type Emoji struct {
// APIString returns a string usable for sending over to the API.
func (e Emoji) APIString() string {
if e.ID == 0 {
if !e.ID.Valid() {
return e.Name // is unicode
}

View File

@ -60,11 +60,11 @@ func (s Snowflake) MarshalJSON() ([]byte, error) {
}
}
// String returns the ID, or nothing if the snowflake isn't valid.
func (s Snowflake) String() string {
if s == NullSnowflake {
if !s.Valid() {
return ""
}
return strconv.FormatUint(uint64(s), 10)
}