Discord.Net icon indicating copy to clipboard operation
Discord.Net copied to clipboard

Adding reactions is slow in 2.2.0

Open Confruggy opened this issue 6 years ago • 2 comments

Adding reactions in 2.2.0 is slower than it was in 2.1.1 I tested it with the following code:

[Command("test")]
public async Task TestCommand(int amount)
{
    for (int i = 0; i < amount; i++)
    {
        var message = await ReplyAsync("test");
        var emotes = new[]
        {
            new Emoji("1️⃣"),
            new Emoji("2️⃣"),
            new Emoji("3️⃣"),
            new Emoji("4️⃣"),
            new Emoji("5️⃣"),
            new Emoji("6️⃣"),
            new Emoji("7️⃣"),
            new Emoji("8️⃣"),
            new Emoji("9️⃣"),
            new Emoji("🔟")
        };
        var stopWatch = new Stopwatch();
        stopWatch.Start();
        await message.AddReactionsAsync(emotes);
        stopWatch.Stop();
        await message.ModifyAsync(x => x.Content = $"{DiscordConfig.Version}: {stopWatch.ElapsedMilliseconds} ms");
        await Task.Delay(5000);
    }
}

The result is that adding reactions in 2.2.0 takes about twice as much.

image

Confruggy avatar Dec 16 '19 16:12 Confruggy

I've found that re-adding this block of code seems to "fix" the issue, since it ignores the reset and lag from the ratelimit headers. Given this, it seems that the longer time is intentional from the API itself.

Chris-Johnston avatar Dec 24 '19 09:12 Chris-Johnston

is this still a thing? i have that issue too.

PentoreXannaci avatar Jul 27 '21 10:07 PentoreXannaci

Reactions suffer from horrible ratelimiting since buttons have been added. I doubt the recent issues come from the same root cause. As stated before, this is probably API intentional.

csmir avatar Feb 09 '23 16:02 csmir