From 8560f850ebe1ee46a2caee47bfcc51325e6c3ab7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 8 Apr 2020 18:56:41 +0200 Subject: [PATCH] Don't send more than 5 embeds at a time in the bot chat --- royalpack/events/discord_lazy_play.py | 6 ++++-- royalpack/events/discord_play.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/royalpack/events/discord_lazy_play.py b/royalpack/events/discord_lazy_play.py index 1f776769..cfdc6235 100644 --- a/royalpack/events/discord_lazy_play.py +++ b/royalpack/events/discord_lazy_play.py @@ -69,12 +69,14 @@ class DiscordLazyPlayEvent(rc.Event): await main_channel.send(rsd.escape(f"▶️ {user} ha aggiunto {len(added)} file _(lazy)_ alla coda:")) else: await main_channel.send(rsd.escape(f"▶️ Aggiunt{'o' if len(added) == 1 else 'i'} {len(added)} file " - f"_(lazy)_ alla coda:")) - for ytd in added: + f"[i](lazy)[/i] alla coda:")) + for ytd in added[:5]: embed: discord.Embed = ytd.embed() if force_color: embed._colour = discord.Colour(force_color) await main_channel.send(embed=embed) + if len(added) > 5: + await main_channel.send(f"e altri {len(added) - 5}!") if len(too_long) > 0: if user: diff --git a/royalpack/events/discord_play.py b/royalpack/events/discord_play.py index 341830cf..4018ef96 100644 --- a/royalpack/events/discord_play.py +++ b/royalpack/events/discord_play.py @@ -72,11 +72,13 @@ class DiscordPlayEvent(rc.Event): else: await main_channel.send(rsd.escape(f"▶️ Aggiunt{'o' if len(added) == 1 else 'i'} {len(added)} file alla" f" coda:")) - for ytd in added: + for ytd in added[:5]: embed: discord.Embed = ytd.embed() if force_color: embed._colour = discord.Colour(force_color) await main_channel.send(embed=embed) + if len(added) > 5: + await main_channel.send(f"e altri {len(added) - 5}!") if len(too_long) > 0: if user: