Add private flag to /timestamp

This commit is contained in:
Zeva Rose 2022-03-28 18:15:29 -06:00
parent 9ae61247a0
commit 2a42ae956c

View file

@ -339,7 +339,10 @@ class UtilCog(Scale):
@slash_option( @slash_option(
name="string", description="String to convert", opt_type=OptionTypes.STRING, required=True name="string", description="String to convert", opt_type=OptionTypes.STRING, required=True
) )
async def _timestamp(self, ctx: InteractionContext, string: str) -> None: @slash_option(
name="private", description="Respond quietly?", opt_type=OptionTypes.BOOLEAN, required=False
)
async def _timestamp(self, ctx: InteractionContext, string: str, private: bool = False) -> None:
timestamp = parse(string) timestamp = parse(string)
if not timestamp: if not timestamp:
await ctx.send("Valid time not found, try again", ephemeral=True) await ctx.send("Valid time not found, try again", ephemeral=True)
@ -360,7 +363,7 @@ class UtilCog(Scale):
EmbedField(name="ISO8601", value=timestamp.isoformat()), EmbedField(name="ISO8601", value=timestamp.isoformat()),
] ]
embed = build_embed(title="Converted Time", description=f"`{string}`", fields=fields) embed = build_embed(title="Converted Time", description=f"`{string}`", fields=fields)
await ctx.send(embed=embed) await ctx.send(embed=embed, ephemeral=private)
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None: