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 = (
|
HELP_TEXT = (
|
||||||
"Available commands:\n"
|
"Available commands:\n"
|
||||||
" !inventory <text list> — update van inventory from a text list\n"
|
" inventory <text list> — update van inventory from a text list\n"
|
||||||
" !inventory (+ photo) — update van inventory from a receipt photo\n"
|
" inventory (+ photo) — update van inventory from a receipt photo\n"
|
||||||
" !status — show bot status\n"
|
" status — show bot status\n"
|
||||||
" !help — show this help message\n"
|
" help — show this help message\n"
|
||||||
"Send a receipt photo with the message '!inventory' to scan it.\n"
|
"Send a receipt photo with the message 'inventory' to scan it.\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -101,11 +101,12 @@ def dispatch(
|
|||||||
return
|
return
|
||||||
|
|
||||||
text = message.message.strip()
|
text = message.message.strip()
|
||||||
|
parts = text.split()
|
||||||
|
|
||||||
prefix = config.cmd_prefix
|
if not parts and not message.attachments:
|
||||||
if not text.startswith(prefix) and not message.attachments:
|
|
||||||
return
|
return
|
||||||
cmd = text.lstrip(prefix).split()[0].lower() if text.startswith(prefix) else ""
|
|
||||||
|
cmd = parts[0].lower() if parts else ""
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
"help": help_action,
|
"help": help_action,
|
||||||
@@ -113,7 +114,14 @@ def dispatch(
|
|||||||
"inventory": inventory_action,
|
"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)
|
action(signal, message, llm, registry, config, cmd)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class BotConfig(BaseModel):
|
|||||||
phone_number: str
|
phone_number: str
|
||||||
inventory_api_url: str
|
inventory_api_url: str
|
||||||
engine: Engine
|
engine: Engine
|
||||||
cmd_prefix: str = "!"
|
|
||||||
reconnect_delay: int = 5
|
reconnect_delay: int = 5
|
||||||
max_reconnect_delay: int = 300
|
max_reconnect_delay: int = 300
|
||||||
max_retries: int = 10
|
max_retries: int = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user