fix(trigger): require names for trigger creation
This commit is contained in:
@@ -218,13 +218,13 @@ if DISCORD_AVAILABLE:
|
||||
command_text = f"/model {preset}" if preset else "/model"
|
||||
await self._forward_slash_command(interaction, command_text)
|
||||
|
||||
@self.tree.command(name="trigger", description="Create a local trigger for this chat")
|
||||
@app_commands.describe(name="Optional trigger name")
|
||||
@self.tree.command(name="trigger", description="Create a named local trigger for this chat")
|
||||
@app_commands.describe(name="Trigger name")
|
||||
async def trigger_command(
|
||||
interaction: discord.Interaction,
|
||||
name: str | None = None,
|
||||
name: str,
|
||||
) -> None:
|
||||
name = (name or "").strip()
|
||||
name = name.strip()
|
||||
command_text = f"/trigger {name}" if name else "/trigger"
|
||||
await self._forward_slash_command(interaction, command_text)
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ class TelegramChannel(BaseChannel):
|
||||
BotCommand("status", "Show bot status"),
|
||||
BotCommand("history", "Show recent conversation messages"),
|
||||
BotCommand("goal", "Start a sustained objective (long-running task)"),
|
||||
BotCommand("trigger", "Create a local trigger for this chat"),
|
||||
BotCommand("trigger", "Create a named local trigger"),
|
||||
BotCommand("pairing", "Manage DM pairing (approve/deny/list)"),
|
||||
BotCommand("model", "Switch runtime model preset"),
|
||||
BotCommand("skill", "List enabled skills"),
|
||||
|
||||
@@ -83,10 +83,10 @@ BUILTIN_COMMAND_SPECS: tuple[BuiltinCommandSpec, ...] = (
|
||||
),
|
||||
BuiltinCommandSpec(
|
||||
"/trigger",
|
||||
"Create local trigger",
|
||||
"Create a CLI trigger bound to this chat session.",
|
||||
"Create named local trigger",
|
||||
"Create a named CLI trigger bound to this chat session.",
|
||||
"zap",
|
||||
"[name]",
|
||||
"<name>",
|
||||
),
|
||||
BuiltinCommandSpec(
|
||||
"/dream",
|
||||
@@ -728,6 +728,18 @@ async def cmd_skill(ctx: CommandContext) -> OutboundMessage:
|
||||
|
||||
async def cmd_trigger(ctx: CommandContext) -> OutboundMessage:
|
||||
"""Create a local trigger bound to the current session."""
|
||||
name = ctx.args.strip()
|
||||
if not name:
|
||||
return OutboundMessage(
|
||||
channel=ctx.msg.channel,
|
||||
chat_id=ctx.msg.chat_id,
|
||||
content=(
|
||||
"Usage: /trigger <name>\n\n"
|
||||
"Create a named local trigger bound to this chat session."
|
||||
),
|
||||
metadata={**dict(ctx.msg.metadata or {}), "render_as": "text"},
|
||||
)
|
||||
|
||||
from nanobot.triggers.store import ExternalTriggerStore
|
||||
|
||||
loop = ctx.loop
|
||||
@@ -741,7 +753,6 @@ async def cmd_trigger(ctx: CommandContext) -> OutboundMessage:
|
||||
if store is None:
|
||||
store = ExternalTriggerStore(workspace)
|
||||
|
||||
name = ctx.args.strip() or "External trigger"
|
||||
trigger = store.create(
|
||||
name=name,
|
||||
channel=ctx.msg.channel,
|
||||
|
||||
Reference in New Issue
Block a user