LemonChannels.Adapters.Telegram.Transport.Commands (lemon_channels v0.1.0)

View Source

Command detection, predicate logic, and message-entry helpers for the Telegram transport.

All functions here are pure (no side effects, no GenServer state mutation). They inspect message text and return booleans or parsed data.

Summary

Functions

Returns true when the text looks like a /command message.

Returns true when the text looks like a /command that is addressed to the given bot (no @suffix, or @suffix matches bot_username).

Join a list of message entries (oldest-first) into a single text block.

Build a compact entry map from an inbound for buffering purposes.

Derive the scope key (used as buffer / media-group map key) from an inbound.

Check whether text starts with /cmd (optionally suffixed with @BotName).

Extract the argument portion after /cmd[@BotName].

Functions

cancel_command?(text, bot_username)

checkpoint_command?(text, bot_username)

command_message?(text)

Returns true when the text looks like a /command message.

command_message_for_bot?(text, bot_username)

Returns true when the text looks like a /command that is addressed to the given bot (no @suffix, or @suffix matches bot_username).

cwd_command?(text, bot_username)

file_command?(text, bot_username)

goal_command?(text, bot_username)

join_messages(messages)

Join a list of message entries (oldest-first) into a single text block.

Returns {joined_text, last_id, last_user_msg_id, last_reply_to_text, last_reply_to_id}.

kanban_command?(text, bot_username)

media_command?(text, bot_username)

message_entry(inbound)

Build a compact entry map from an inbound for buffering purposes.

model_command?(text, bot_username)

new_command?(text, bot_username)

reload_command?(text, bot_username)

resume_command?(text, bot_username)

rollback_command?(text, bot_username)

scope_key(inbound)

Derive the scope key (used as buffer / media-group map key) from an inbound.

telegram_command?(text, cmd, bot_username)

Check whether text starts with /cmd (optionally suffixed with @BotName).

telegram_command_args(text, cmd)

Extract the argument portion after /cmd[@BotName].

thinking_command?(text, bot_username)

topic_command?(text, bot_username)

trigger_command?(text, bot_username)