diff --git a/twitch/component.py b/twitch/component.py index 4759a1a..5685c3c 100644 --- a/twitch/component.py +++ b/twitch/component.py @@ -5,14 +5,15 @@ from twitchio import PartialUser from twitchio.ext import commands as cmds from meta import Bot -from twitch.client import TwitchCmdClient from utils.lib import utc_now -from . import logger from ..customcmd.data import CustomCmd, CustomCmdData from ..customcmd.client import ExecClient from ..customcmd.parser import ExecContext +from . import logger +from .client import TwitchCmdClient + # TODO: Make an alphacroc or croccyalpha client for testing # TODO: Fix the tracker not actually guarding the commands properly @@ -58,13 +59,16 @@ class CustomCmdComponent(cmds.Component): # Make sure the command parses (can't guarantee it runs, but at least it can parse) try: - await self.cmdclient.run_command(ExecContext(args=[], content=""), response) + await self.cmdclient.run_command( + ExecContext(args=[], content=""), response, dryrun=True + ) except Exception: # TODO: Nicer errors for pinpointing problem await ctx.reply(f"Sorry, could not parse your command!") logger.info( f"Failed to parse attempted customcmd '{response}'", exc_info=True ) + return # If everything is good, add it to the table # TODO: Again, permission resolution diff --git a/twitch/context.py b/twitch/context.py index 9c26bc4..f7bbe8b 100644 --- a/twitch/context.py +++ b/twitch/context.py @@ -1,7 +1,7 @@ import twitchio from meta import Bot -from utils.lib import utc_now, strfdur +from utils.lib import utc_now, strfdelta from ..customcmd.parser import ExecContext from ..customcmd.client import ExecClient @@ -34,7 +34,7 @@ class CustomCmdUser: followed_at = follower.followed_at if followed_at: - durstr = strfdur(utc_now() - followed_at) + durstr = strfdelta(utc_now() - followed_at) resp = ( f"{self.user.mention} has been following {channel.mention} for {durstr}" )