mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
removed comand prefix
This commit is contained in:
@@ -24,11 +24,11 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
HELP_TEXT = (
|
||||
"Available commands:\n"
|
||||
" !inventory <text list> — update van inventory from a text list\n"
|
||||
" !inventory (+ photo) — update van inventory from a receipt photo\n"
|
||||
" !status — show bot status\n"
|
||||
" !help — show this help message\n"
|
||||
"Send a receipt photo with the message '!inventory' to scan it.\n"
|
||||
" inventory <text list> — update van inventory from a text list\n"
|
||||
" inventory (+ photo) — update van inventory from a receipt photo\n"
|
||||
" status — show bot status\n"
|
||||
" help — show this help message\n"
|
||||
"Send a receipt photo with the message 'inventory' to scan it.\n"
|
||||
)
|
||||
|
||||
|
||||
@@ -101,11 +101,12 @@ def dispatch(
|
||||
return
|
||||
|
||||
text = message.message.strip()
|
||||
parts = text.split()
|
||||
|
||||
prefix = config.cmd_prefix
|
||||
if not text.startswith(prefix) and not message.attachments:
|
||||
if not parts and not message.attachments:
|
||||
return
|
||||
cmd = text.lstrip(prefix).split()[0].lower() if text.startswith(prefix) else ""
|
||||
|
||||
cmd = parts[0].lower() if parts else ""
|
||||
|
||||
commands = {
|
||||
"help": help_action,
|
||||
@@ -113,7 +114,14 @@ def dispatch(
|
||||
"inventory": inventory_action,
|
||||
}
|
||||
|
||||
action = commands.get(cmd, unknown_action)
|
||||
action = commands.get(cmd)
|
||||
if action is None:
|
||||
if message.attachments:
|
||||
action = inventory_action
|
||||
cmd = "inventory"
|
||||
else:
|
||||
return
|
||||
|
||||
action(signal, message, llm, registry, config, cmd)
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ class BotConfig(BaseModel):
|
||||
phone_number: str
|
||||
inventory_api_url: str
|
||||
engine: Engine
|
||||
cmd_prefix: str = "!"
|
||||
reconnect_delay: int = 5
|
||||
max_reconnect_delay: int = 300
|
||||
max_retries: int = 10
|
||||
|
||||
Reference in New Issue
Block a user