qrm2/exts/time.py
0x5c 6e54a27f14
Release the Cats! - Reorganised extensions and recategorised commands
Fixes #389 - Main issue
Fixes #388 - Accidental, Satmatch deadcode removal
2021-03-28 09:50:51 -04:00

36 lines
885 B
Python

"""
Time extension for qrm
---
Copyright (C) 2021 classabbyamp, 0x5c
This file is part of qrm2 and is released under the terms of
the GNU General Public License, version 2.
"""
from datetime import datetime
import discord.ext.commands as commands
import common as cmn
class TimeCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name="utc", aliases=["z"], category=cmn.Cats.TIME)
async def _utc_lookup(self, ctx: commands.Context):
"""Returns the current time in UTC."""
now = datetime.utcnow()
result = "**" + now.strftime("%Y-%m-%d %H:%M") + "Z**"
embed = cmn.embed_factory(ctx)
embed.title = "The current time is:"
embed.description = result
embed.colour = cmn.colours.good
await ctx.send(embed=embed)
def setup(bot: commands.Bot):
bot.add_cog(TimeCog(bot))