Add marco

pull/125/head
stijndcl 2022-08-09 23:46:41 +02:00
parent 8aedde46de
commit 94de47082b
2 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,11 @@ class Meta(commands.Cog):
def __init__(self, client: Didier): def __init__(self, client: Didier):
self.client = client self.client = client
@commands.command(name="Marco")
async def marco(self, ctx: commands.Context):
"""Ping command to get the delay of the bot"""
return await ctx.reply(f"Polo! {round(self.client.latency * 1000)}ms", mention_author=False)
@commands.command(name="Source", aliases=["Src"]) @commands.command(name="Source", aliases=["Src"])
async def source(self, ctx: commands.Context, *, command_name: Optional[str] = None): async def source(self, ctx: commands.Context, *, command_name: Optional[str] = None):
"""Command to get links to the source code of Didier""" """Command to get links to the source code of Didier"""

View File

@ -12,7 +12,7 @@ __all__ = ["AddDadJoke"]
class AddDadJoke(discord.ui.Modal, title="Add Dad Joke"): class AddDadJoke(discord.ui.Modal, title="Add Dad Joke"):
"""Modal to add a new dad joke""" """Modal to add a new dad joke"""
name: discord.ui.TextInput = discord.ui.TextInput( joke: discord.ui.TextInput = discord.ui.TextInput(
label="Joke", label="Joke",
placeholder="I sold our vacuum cleaner, it was just gathering dust.", placeholder="I sold our vacuum cleaner, it was just gathering dust.",
style=discord.TextStyle.long, style=discord.TextStyle.long,
@ -27,7 +27,7 @@ class AddDadJoke(discord.ui.Modal, title="Add Dad Joke"):
@overrides @overrides
async def on_submit(self, interaction: discord.Interaction): async def on_submit(self, interaction: discord.Interaction):
async with self.client.postgres_session as session: async with self.client.postgres_session as session:
joke = await add_dad_joke(session, str(self.name.value)) joke = await add_dad_joke(session, str(self.joke.value))
await interaction.response.send_message(f"Successfully added joke #{joke.dad_joke_id}", ephemeral=True) await interaction.response.send_message(f"Successfully added joke #{joke.dad_joke_id}", ephemeral=True)