-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Here's a simple Discord bot. It prints out when somebody adds a reaction to the message.
#!raku
use API::Discord;
sub MAIN(Str $token) {
my $discord = API::Discord.new(:$token);
$discord.connect;
await $discord.ready;
my $channel = $discord.get-channel(465122426221756426);
my $message = await $channel.send-message("React to me");
react {
whenever $message.events -> $r {
$r.say;
}
}
}
And I react to it with 👌
« ♥
» ♥
All guilds ready!
{d => {channel_id => 465122426221756426, emoji => {id => (Any), name => 👌}, guild_id => 269438629775015936, member => {deaf => False, hoisted_role => 269513102712635393, joined_at => 2017-01-13T12:14:04.372000+00:00, mute => False, nick => (Any), premium_since => 2019-12-09T11:16:52.299000+00:00, roles => [269513102712635393 653555662445608969], user => {avatar => 0eabcd875d9a0fce4a194f7c58dec5a3, discriminator => 2319, id => 240882564770955275, username => altreus™}}, message_id => 693517208554569779, user_id => 240882564770955275}, op => 0, s => 4, t => MESSAGE_REACTION_ADD}
Now we have the bot react to the message
$message.add-reaction('☺');
And we hear about the bot's reaction in the react, even though it's already happened:
« ♥
» ♥
All guilds ready!
{d => {channel_id => 465122426221756426, emoji => {id => (Any), name => ☺}, guild_id => 269438629775015936, member => {deaf => False, hoisted_role => (Any), joined_at => 2020-03-26T22:27:02.164045+00:00, mute => False, nick => (Any), premium_since => (Any), roles => [692871222450585610], user => {avatar => (Any), bot => True, discriminator => 2915, id => 692861210659389472, username => vurl}}, message_id => 693518655128076299, user_id => 692861210659389472}, op => 0, s => 4, t => MESSAGE_REACTION_ADD}
{d => {channel_id => 465122426221756426, emoji => {id => 675035435302387785, name => eng101}, guild_id => 269438629775015936, member => {deaf => False, hoisted_role => 269513102712635393, joined_at => 2017-01-13T12:14:04.372000+00:00, mute => False, nick => (Any), premium_since => 2019-12-09T11:16:52.299000+00:00, roles => [269513102712635393 653555662445608969], user => {avatar => 0eabcd875d9a0fce4a194f7c58dec5a3, discriminator => 2319, id => 240882564770955275, username => altreus™}}, message_id => 693518655128076299, user_id => 240882564770955275}, op => 0, s => 5, t => MESSAGE_REACTION_ADD}
We've tried this with sleeps in it and it still returns all historical emoji, even though the supply should be live.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed