Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reaction supply sends historical reactions when tapped. #38

Open
Altreus opened this issue Mar 28, 2020 · 1 comment
Open

Reaction supply sends historical reactions when tapped. #38

Altreus opened this issue Mar 28, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@Altreus
Copy link
Member

Altreus commented Mar 28, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant