Skip to content

Commit

Permalink
Also support custom emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
Altreus committed Sep 17, 2018
1 parent f25631d commit 4afa4b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions examples/autostar.p6
Expand Up @@ -9,7 +9,10 @@ sub MAIN($token) {

react {
whenever $discord.messages -> $message {
# These return Promises that we're ignoring.
# Real code should await these and check for errors
$message.add-reaction('');
$message.add-reaction('awoo:486257857277460490')
}
}
}
6 changes: 3 additions & 3 deletions lib/API/Discord/Message.pm6
Expand Up @@ -128,9 +128,9 @@ method channel {
$.api.get-channel($.channel-id)
}

method add-reaction(Str $e) {
my $emoji = uri_encode_component($e);
Reaction.new(:$emoji, :user('@me'), :message(self)).create($.api.rest);
method add-reaction(Str $e is copy) {
$e = uri_encode_component($e) unless $e ~~ /\:/;
Reaction.new(:emoji($e), :user('@me'), :message(self)).create($.api.rest);
}

#| Inflates the Message object from the JSON we get from Discord
Expand Down

0 comments on commit 4afa4b0

Please sign in to comment.