Browse Source

Added second sample for adding reactions

pull/1161/head
Joe4evr 7 years ago
parent
commit
a139e94576
3 changed files with 26 additions and 1 deletions
  1. +9
    -1
      docs/faq/basics/basic-operations.md
  2. +0
    -0
      docs/faq/basics/samples/emoji-others.cs
  3. +17
    -0
      docs/faq/basics/samples/emoji-self.cs

+ 9
- 1
docs/faq/basics/basic-operations.md View File

@@ -74,7 +74,15 @@ In Discord.Net, an Emote represents a custom-image emote, while an
Emoji is a Unicode emoji (standard emoji). Both [Emoji] and [Emote]
implement [IEmote] and are valid options.

[!code-csharp[Emoji](samples/emoji.cs)]
# [Adding a reaction to another message](#tab/emoji-others)

[!code-csharp[Emoji](samples/emoji-others.cs)]

# [Adding a reaction to a sent message](#tab/emoji-self)

[!code-csharp[Emoji](samples/emoji-self.cs)]

***

[AddReactionAsync]: xref:Discord.IUserMessage.AddReactionAsync*



docs/faq/basics/samples/emoji.cs → docs/faq/basics/samples/emoji-others.cs View File


+ 17
- 0
docs/faq/basics/samples/emoji-self.cs View File

@@ -0,0 +1,17 @@
// capture the message you're sending in a variable
var msg = await channel.SendMessageAsync("This will have reactions added.");

// standard Unicode emojis
Emoji emoji = new Emoji("👍");
// or
// Emoji emoji = new Emoji("\uD83D\uDC4D");

// custom guild emotes
Emote emote = Emote.Parse("<:dotnet:232902710280716288>");
// using Emote.TryParse may be safer in regards to errors being thrown;
// please note that the method does not verify if the emote exists,
// it simply creates the Emote object for you.

// add the reaction to the message
await msg.AddReactionAsync(emoji);
await msg.AddReactionAsync(emote);

Loading…
Cancel
Save