npm install -g node-telegram-clintg --versionntg login once — interactive, requires phone number + OTP code from Telegram--json flag to every command for machine-readable output--json is a global flag — place it before or after the subcommandntg --json inbox, ntg --json search @user "keyword"@username — most reliable, e.g. @johndoe+84901234567me — your own Saved Messages"My Group"ntg --json inbox — list recent conversationsntg --json inbox --unread — only unread conversationsntg --json inbox --private — only private 1-on-1 chatsntg --json inbox --unread --private — combine filtersntg --json inbox --chat --limit — messages from a specific chatntg --json search "keyword" — search in a specific chatntg --json global-search "keyword" — search across all chatsntg --json chat-info — show group/channel infontg msg "text" — send a text messagentg msg "text" --silent — send silently (no notification sound)ntg fwd — forward a message by IDntg mark-read — mark all messages as readntg delete-msg — delete a messagentg send-photo — send a photontg send-video — send a videontg send-file — send a text file as plain messagesntg download --chat — download media from a messagentg download --chat --type — specify media type (photo, video, audio, doc)ntg view --chat — download and open with system viewerntg clean-downloads — delete all downloaded media filesntg create-group "Topic" @user1 @user2 — create a new groupntg chat-add — add a user to a groupntg chat-kick — remove a user from a groupntg chat-rename "New Name" — rename a groupntg chat-set-photo — set group photontg add-contact — add a contactntg rename-contact — rename a contactname — contact/chat display namepeer — identifier to use as argumentpeerType — "username" | "phone" | "id"type — "user" | "group" | "channel"unreadCount — number of unread messageslastMessage — text/caption (empty string if media-only)lastMessageId — use with ntg download for mediamediaType — "photo" | "video" | "document" | "audio" | "voice" | "sticker" | "location" | "contact" | "poll" | nulldate — ISO 8601 timestampid — message IDdate — ISO 8601 timestampsender — sender display nametext — message text/captionmediaType — same values as aboveisOutgoing — true if sent by you0 = success1 = error (not logged in, peer not found, etc.)ntg chat — it is interactive, blocks stdin, not suitable for automationntg logout is called — no re-login needed between commands~/.telegram-cli/downloads/--chat when downloading media to identify the source chat共 1 个版本