Browse Source

QOL for emotes/emoji

pull/1923/head
quin lynch 3 years ago
parent
commit
df04c50092
2 changed files with 6 additions and 3 deletions
  1. +4
    -3
      src/Discord.Net.Core/Entities/Emotes/Emoji.cs
  2. +2
    -0
      src/Discord.Net.Core/Entities/Emotes/Emote.cs

+ 4
- 3
src/Discord.Net.Core/Entities/Emotes/Emoji.cs View File

@@ -64,9 +64,8 @@ namespace Discord
return result != null;
}

/// <summary> Parse an <see cref="Emoji"/> from its raw format. </summary>
/// <param name="text">The raw encoding of an emoji. For example: <c>:heart: or ❤</c></param>
/// <param name="result">An emoji.</param>
/// <summary> Parse an <see cref="Emoji"/> from its raw format.</summary>
/// <param name="emojiStr">The raw encoding of an emoji. For example: <c>:heart: or ❤</c></param>
/// <exception cref="FormatException">String is not emoji or unicode!</exception>
public static Emoji Parse(string emojiStr)
{
@@ -5971,5 +5970,7 @@ namespace Discord
return _unicodesAndNames;
}
}

public static implicit operator Emoji(string s) => Parse(s);
}
}

+ 2
- 0
src/Discord.Net.Core/Entities/Emotes/Emote.cs View File

@@ -102,5 +102,7 @@ namespace Discord
/// A string representing the raw presentation of the emote (e.g. <c>&lt;:thonkang:282745590985523200&gt;</c>).
/// </returns>
public override string ToString() => $"<{(Animated ? "a" : "")}:{Name}:{Id}>";

public static implicit operator Emote(string s) => Parse(s);
}
}

Loading…
Cancel
Save