diff --git a/didier/cogs/fun.py b/didier/cogs/fun.py index c013a0b..6a89833 100644 --- a/didier/cogs/fun.py +++ b/didier/cogs/fun.py @@ -102,8 +102,7 @@ class Fun(commands.Cog): async def memegen_preview_msg(self, ctx: commands.Context, template: str): """Generate a preview for the meme template `template`, to see how the fields are structured.""" async with ctx.typing(): - fields = [f"Field #{i + 1}" for i in range(20)] - meme = await self._do_generate_meme(template, fields) + meme = await self._do_generate_meme(template, []) return await ctx.reply(meme, mention_author=False) @memes_slash.command(name="generate") @@ -121,8 +120,7 @@ class Fun(commands.Cog): """Generate a preview for a meme, to see how the fields are structured.""" await interaction.response.defer(ephemeral=True) - fields = [f"Field #{i + 1}" for i in range(20)] - meme_url = await self._do_generate_meme(template, fields) + meme_url = await self._do_generate_meme(template, []) await interaction.followup.send(meme_url, ephemeral=True) diff --git a/didier/data/apis/imgflip.py b/didier/data/apis/imgflip.py index c44eea6..416e22c 100644 --- a/didier/data/apis/imgflip.py +++ b/didier/data/apis/imgflip.py @@ -10,6 +10,10 @@ __all__ = ["generate_meme"] def generate_boxes(meme: MemeTemplate, fields: list[str]) -> list[str]: """Generate the template boxes for Imgflip""" + # If no fields were passed, generate a template instead + if not fields: + fields = [f"Field #{i + 1}" for i in range(meme.field_count)] + # If a meme only has 1 field, join all the arguments together into one string if meme.field_count == 1: fields = [" ".join(fields)]