from time import monotonic

from discord.ext import commands


class ModuleUptime(commands.Cog):
    def __init__(self, _bot):
        self.started = monotonic()

    @commands.command(help="moduleuptime » show time since the module loaded")
    async def moduleuptime(self, ctx):
        elapsed = int(monotonic() - self.started)
        hours, rest = divmod(elapsed, 3600)
        minutes, seconds = divmod(rest, 60)
        await ctx.send(f"-# `∕` Loaded for `{hours}h {minutes}m {seconds}s`.")
