22 lines
722 B
Python
22 lines
722 B
Python
import time
|
|
|
|
class UptimePlugin:
|
|
def __init__(self, bot):
|
|
"""Guarda la referencia al bot y usa su tiempo de inicio."""
|
|
self.bot = bot
|
|
|
|
def run(self, sender=None, *args):
|
|
"""Muestra cuánto tiempo lleva corriendo el bot."""
|
|
if not hasattr(self.bot, "start_time"):
|
|
self.bot.start_time = time.time() # Asegurar que `start_time` exista
|
|
|
|
uptime_seconds = int(time.time() - self.bot.start_time)
|
|
hours, remainder = divmod(uptime_seconds, 3600)
|
|
minutes, seconds = divmod(remainder, 60)
|
|
return f"⏳ **Uptime:** {hours}h {minutes}m {seconds}s"
|
|
|
|
|
|
def help(self):
|
|
return "Uso: .uptime - Muestra cuánto tiempo lleva encendido el bot."
|
|
|