mirror of https://github.com/stijndcl/didier
Meme preview slash command
parent
a0c1b986cd
commit
f9083e84ed
|
@ -64,7 +64,20 @@ class Fun(commands.Cog):
|
|||
modal = GenerateMeme(self.client, result)
|
||||
await interaction.response.send_modal(modal)
|
||||
|
||||
@memes_slash.command(
|
||||
name="preview", description="Generate a preview for a meme, to see how the fields are structured"
|
||||
)
|
||||
async def memegen_preview_slash(self, interaction: discord.Interaction, meme: str):
|
||||
"""Slash command to generate a meme preview"""
|
||||
await interaction.response.defer()
|
||||
|
||||
fields = [f"Field #{i + 1}" for i in range(20)]
|
||||
meme_url = await self._do_generate_meme(meme, fields)
|
||||
|
||||
await interaction.followup.send(meme_url)
|
||||
|
||||
@memegen_slash.autocomplete("meme")
|
||||
@memegen_preview_slash.autocomplete("meme")
|
||||
async def _memegen_slash_autocomplete_meme(
|
||||
self, _: discord.Interaction, current: str
|
||||
) -> list[app_commands.Choice[str]]:
|
||||
|
|
|
@ -38,10 +38,6 @@ class GenerateMeme(discord.ui.Modal, title="Generate Meme"):
|
|||
fields = [item.value for item in self.children if isinstance(item, discord.ui.TextInput)]
|
||||
|
||||
meme_url = await generate_meme(self.client.http_session, self.meme, fields)
|
||||
|
||||
if meme_url is None:
|
||||
return await interaction.followup.send("Something went wrong.")
|
||||
|
||||
await interaction.followup.send(meme_url)
|
||||
|
||||
@overrides
|
||||
|
|
Loading…
Reference in New Issue