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

CollectReactionsAsync() does not seem to work #1542

Open
LorryGailius opened this issue Apr 17, 2023 · 2 comments
Open

CollectReactionsAsync() does not seem to work #1542

LorryGailius opened this issue Apr 17, 2023 · 2 comments

Comments

@LorryGailius
Copy link

LorryGailius commented Apr 17, 2023

Summary

Trying to get all reactions for a specific discord message and CollectReactionsAsync() never goes through. Console writes "Start" and never reaches "End", tried to do the same with interacitivy.CollectReactionsAsync(discordMessage, TimeSpan.Zero) and it still did not work

Tried running the latest stable and nightly builds of DSharpPlus on .net 7 and .net framewrok 4.8.1 console applications with no
avail

                var questionMessage = new DiscordEmbedBuilder()
                {
                    Title = $"{question.question}",
                    Description = $"Time remaining: {time} seconds",
                };
                var discordMessage = await context.Channel.SendMessageAsync(embed: questionMessage);
                time--;

                foreach (DiscordEmoji em in emoji)
                {
                    await discordMessage.CreateReactionAsync(em);
                }

                for (int i = 0; i <= time; time--)
                {
                    await Task.Delay(1000);
                    var newmessage = new DiscordEmbedBuilder()
                    {
                        Title = $"{question.question}",
                        Description = $"{emoji[0]} | {answers[0]}\n\n" + $"{emoji[1]} | {answers[1]}\n\n" + $"{emoji[2]} | {answers[2]}\n\n" + $"{emoji[3]} | {answers[3]}\n\n" + $"Time remaining: {time} seconds",
                    };
                    await discordMessage.ModifyAsync(new DiscordMessageBuilder().AddEmbed(newmessage));
                }
                // Find index with correct answer
                int correctIdx = answers.IndexOf(question.correct_answer);

                Console.WriteLine("Start");

                // THIS DOES NOT WORK
                var reactions = await discordMessage.CollectReactionsAsync();

                Console.WriteLine("End");
@akiraveliara
Copy link
Contributor

do you have any stacktrace or other sort of error message, potentially in your CommandErrored event?

@LorryGailius
Copy link
Author

LorryGailius commented Apr 17, 2023

I have added CommandErrored event like this:

Commands = Client.UseCommandsNext(CommandsNextConfiguration);
Commands.RegisterCommands<Essential>();
Commands.CommandErrored += Commands_CommandErrored;
private Task Commands_CommandErrored(CommandsNextExtension sender, CommandErrorEventArgs args)
{
    Console.WriteLine($"[CommandErrored] {args.Exception.Message}");
    return Task.CompletedTask;
}

But when calling CollectReactionsAsync() it does not trigger the event and does not post to console. Am i doing something wrong? I tried to change the MinimumLogLevel = LogLevel.Trace in DiscordConfiguration() but all mesages to console end once it goes past the ModifyAsync() methods and "Start" in the Issue code.

@akiraveliara akiraveliara added this to the v5.0 milestone Oct 5, 2023
@akiraveliara akiraveliara removed the v5.x label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants