fix(twitch): Fix broken imports
This commit is contained in:
+7
-3
@@ -5,14 +5,15 @@ from twitchio import PartialUser
|
|||||||
from twitchio.ext import commands as cmds
|
from twitchio.ext import commands as cmds
|
||||||
|
|
||||||
from meta import Bot
|
from meta import Bot
|
||||||
from twitch.client import TwitchCmdClient
|
|
||||||
from utils.lib import utc_now
|
from utils.lib import utc_now
|
||||||
|
|
||||||
from . import logger
|
|
||||||
from ..customcmd.data import CustomCmd, CustomCmdData
|
from ..customcmd.data import CustomCmd, CustomCmdData
|
||||||
from ..customcmd.client import ExecClient
|
from ..customcmd.client import ExecClient
|
||||||
from ..customcmd.parser import ExecContext
|
from ..customcmd.parser import ExecContext
|
||||||
|
|
||||||
|
from . import logger
|
||||||
|
from .client import TwitchCmdClient
|
||||||
|
|
||||||
# TODO: Make an alphacroc or croccyalpha client for testing
|
# TODO: Make an alphacroc or croccyalpha client for testing
|
||||||
# TODO: Fix the tracker not actually guarding the commands properly
|
# 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)
|
# Make sure the command parses (can't guarantee it runs, but at least it can parse)
|
||||||
try:
|
try:
|
||||||
await self.cmdclient.run_command(ExecContext(args=[], content=""), response)
|
await self.cmdclient.run_command(
|
||||||
|
ExecContext(args=[], content=""), response, dryrun=True
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
# TODO: Nicer errors for pinpointing problem
|
# TODO: Nicer errors for pinpointing problem
|
||||||
await ctx.reply(f"Sorry, could not parse your command!")
|
await ctx.reply(f"Sorry, could not parse your command!")
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Failed to parse attempted customcmd '{response}'", exc_info=True
|
f"Failed to parse attempted customcmd '{response}'", exc_info=True
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# If everything is good, add it to the table
|
# If everything is good, add it to the table
|
||||||
# TODO: Again, permission resolution
|
# TODO: Again, permission resolution
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import twitchio
|
import twitchio
|
||||||
|
|
||||||
from meta import Bot
|
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.parser import ExecContext
|
||||||
from ..customcmd.client import ExecClient
|
from ..customcmd.client import ExecClient
|
||||||
@@ -34,7 +34,7 @@ class CustomCmdUser:
|
|||||||
followed_at = follower.followed_at
|
followed_at = follower.followed_at
|
||||||
|
|
||||||
if followed_at:
|
if followed_at:
|
||||||
durstr = strfdur(utc_now() - followed_at)
|
durstr = strfdelta(utc_now() - followed_at)
|
||||||
resp = (
|
resp = (
|
||||||
f"{self.user.mention} has been following {channel.mention} for {durstr}"
|
f"{self.user.mention} has been following {channel.mention} for {durstr}"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user