feat(moderation): added tdc command
All checks were successful
Pylint / Pylint (push) Successful in 1m15s
All checks were successful
Pylint / Pylint (push) Successful in 1m15s
This commit is contained in:
parent
f6868c6c48
commit
0deb589198
1 changed files with 15 additions and 0 deletions
|
@ -65,6 +65,9 @@ class Moderation(commands.Cog):
|
||||||
if await self.config.ignore_other_bots() is True:
|
if await self.config.ignore_other_bots() is True:
|
||||||
if entry.user.bot or entry.target.bot:
|
if entry.user.bot or entry.target.bot:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
if entry.user.id == self.bot.user.id:
|
||||||
|
return
|
||||||
duration = "NULL"
|
duration = "NULL"
|
||||||
if entry.reason:
|
if entry.reason:
|
||||||
reason = entry.reason + " (This action was performed without the bot.)"
|
reason = entry.reason + " (This action was performed without the bot.)"
|
||||||
|
@ -309,3 +312,15 @@ class Moderation(commands.Cog):
|
||||||
else:
|
else:
|
||||||
send = f"Configuration changed:\n{message}"
|
send = f"Configuration changed:\n{message}"
|
||||||
await interaction.response.send_message(send, ephemeral=True)
|
await interaction.response.send_message(send, ephemeral=True)
|
||||||
|
|
||||||
|
@commands.command(aliases=["tdc"])
|
||||||
|
async def timedeltaconvert(self, ctx: commands.Context, *, duration: str = None):
|
||||||
|
if not duration:
|
||||||
|
embed = discord.Embed(description=f"## timedeltaconvert\nThis command converts a duration to a `timedelta` Python object.\n### Example Usage\n`{ctx.prefix}timedeltaconvert 1 day 15hr 82 minutes 52 s`\n### Output\n`1 day, 16:22:52`", color=await self.bot.get_embed_color(None))
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
parsed_time = parse(duration, as_timedelta=True, raise_exception=True)
|
||||||
|
await ctx.send(f"`{str(parsed_time)}`")
|
||||||
|
except ValueError:
|
||||||
|
await ctx.send("Please provide a convertible value!")
|
||||||
|
|
Loading…
Reference in a new issue