• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialproductivity

configure

プラグイン
telegram
ソース
GitHub で見る ↗
説明

Telegramチャネルをセットアップします。ボットトークン(ロボット認証キー)を保存し、アクセスポリシー(誰がメッセージを送受信できるかの設定)を確認します。 次のような場合に使用: - ユーザーがTelegramのボットトークンを貼り付けたとき - Telegramの設定方法を尋ねられたとき - 「これはどう設定するの?」「誰が私に連絡できるの?」と聞かれたとき - チャネルの状態を確認したいとき

原文を表示

Set up the Telegram channel — save the bot token and review access policy. Use when the user pastes a Telegram bot token, asks to configure Telegram, asks "how do I set this up" or "who can reach me," or wants to check channel status.

ユースケース
  • ボットトークンを保存するとき
  • Telegramの設定方法を確認するとき
  • アクセスポリシーを設定するとき
  • チャネルの状態を確認したいとき
本文(日本語訳)

/telegram:configure — Telegramチャンネルの設定

ボットトークン(認証情報)を <state-dir>/.env に保存し、アクセス権限の設定方法をユーザーに説明します。サーバーは起動時に両方のファイルを読み込みます。

まず状態ディレクトリを確認してください(マルチボット構成やプロジェクト別設定で上書きされることもあります):

echo "${TELEGRAM_STATE_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/channels/telegram}"

表示されたパスを以下の <state-dir> の代わりに使用してください。デフォルトは ~/.claude/channels/telegram です。

渡された引数: $ARGUMENTS


引数による処理の分岐

引数なし — 状態確認と次のステップの案内

両方の状態ファイルを読み込み、ユーザーに現在の設定状況を説明します:

  1. トークン — <state-dir>/.env から TELEGRAM_BOT_TOKEN を確認

    • 設定済みか未設定かを表示
    • 設定済みの場合は最初の10文字をマスク表示(123456789:...)
  2. アクセス権限 — <state-dir>/access.json を読み込む(ファイルがない場合 = デフォルト設定:dmPolicy: "pairing"、許可リスト空)

    • DM(ダイレクトメッセージ)ポリシーと意味を1行で説明
    • 許可済みの送信者:数と表示名またはID
    • ペアリング待機中:数、コード、表示名(あれば)
  3. 次のステップ — 現在の設定に基づいた具体的な次のアクション:

    • トークンなし → 「/telegram:configure <token> にBotFatherから取得したトークンを付けて実行してください」
    • トークン設定済み、ポリシーがペアリング、許可者なし → 「TelegramでボットにDMを送信してください。ボットが返すコードを /telegram:access pair <コード> で承認してください」
    • トークン設定済み、許可者あり → 「準備完了。ボットにDMを送ればアシスタントに届きます」

常にセキュアな状態を目指す — 全ての設定の最終形は「許可リスト」で特定のユーザーのみ許可することです。「ペアリング」は一時的な設定であり、長期的な状態ではありません。未知のTelegramユーザーIDを取得するための仮の方法に過ぎません。IDを取得したら、ペアリングの役目は終わり、オフにするべきです。

次のように段階的に進めてください:

  1. 許可リストを確認し、誰が登録されているか伝える
  2. 「このボット経由であなたに連絡すべき全員が登録されていますか?」と確認
  3. 「はい」でポリシーがペアリング中の場合 → 「では他の人がペアリングコードを作成できないようロックしましょう」と言い、/telegram:access policy allowlist の実行を提案する。聞かれるのを待たず、積極的に勧める
  4. 「いいえ、人が足りない」場合 → 「他の人にボットにDMさせてください。各自のコードを /telegram:access pair <コード> で承認します。全員が登録できたらこのスキルを再実行してロックしましょう」と説明
  5. 許可リストが空で、ユーザー自身がまだペアリングしていない場合 → 「まずあなた自身がボットにDMを送ってIDを登録してください。それから他の人を追加して、最後にロックします」
  6. ポリシーが既に『許可リスト』の場合 → これがロック状態であることを確認。ユーザーが誰かを追加する必要がある場合:「その人は数字のIDを伝える必要があります(@userinfobotにメッセージして取得可能)。または一時的にペアリングに切り替えることもできます:/telegram:access policy pairing → 相手がDM → あなたが承認 → 戻す」

ペアリングを長期的な選択肢として位置付けないでください。ロック状態への移行を必ず提案してください。

<token> — トークンを保存

  1. $ARGUMENTS をトークンとして扱い、前後の空白を削除
    • BotFatherのトークン形式は 123456789:AAH...(数字+コロン+長い文字列)
  2. 必要に応じて <state-dir> をディレクトリ作成(mkdir -p)
  3. 既存の .env があれば読み込み、TELEGRAM_BOT_TOKEN= の行を更新または追加し、他のキーは保持してから書き戻す。値は引用符で囲まない
  4. <state-dir>/.env に対して chmod 600 を実行(トークンは認証情報のため)
  5. 確認メッセージを表示し、その後no-argsの状態確認を実行して、ユーザーが現在地を把握できるようにする

clear — トークンを削除

TELEGRAM_BOT_TOKEN= の行を削除(その行が唯一の内容なら、ファイル全体を削除)


実装上の注意

  • channelsディレクトリはサーバーが未実行なら存在しないことがあります。ファイル欠落は未設定であり、エラーではありません
  • サーバーは起動時に .env を一度だけ読み込みます。トークン変更後は、セッション再起動または /reload-plugins が必要です。保存後に伝えてください
  • access.json は受信メッセージごとに再読み込みされます。/telegram:access でのポリシー変更は即座に反映され、再起動は不要です
原文(English)を表示

/telegram:configure — Telegram Channel Setup

Writes the bot token to <state-dir>/.env and orients the user on access policy. The server reads both files at boot.

Resolve the state directory first (it may be overridden for multi-bot or per-project setups):

echo "${TELEGRAM_STATE_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/channels/telegram}"

Use the printed path everywhere below in place of <state-dir>. The default is ~/.claude/channels/telegram.

Arguments passed: $ARGUMENTS


Dispatch on arguments

No args — status and guidance

Read both state files and give the user a complete picture:

  1. Token — check <state-dir>/.env for TELEGRAM_BOT_TOKEN. Show set/not-set; if set, show first 10 chars masked (123456789:...).

  2. Access — read <state-dir>/access.json (missing file = defaults: dmPolicy: "pairing", empty allowlist). Show:

    • DM policy and what it means in one line
    • Allowed senders: count, and list display names or IDs
    • Pending pairings: count, with codes and display names if any
  3. What next — end with a concrete next step based on state:

    • No token → "Run /telegram:configure <token> with the token from BotFather."
    • Token set, policy is pairing, nobody allowed → "DM your bot on Telegram. It replies with a code; approve with /telegram:access pair <code>."
    • Token set, someone allowed → "Ready. DM your bot to reach the assistant."

Push toward lockdown — always. The goal for every setup is allowlist with a defined list. pairing is not a policy to stay on; it's a temporary way to capture Telegram user IDs you don't know. Once the IDs are in, pairing has done its job and should be turned off.

Drive the conversation this way:

  1. Read the allowlist. Tell the user who's in it.
  2. Ask: "Is that everyone who should reach you through this bot?"
  3. If yes and policy is still pairing → "Good. Let's lock it down so nobody else can trigger pairing codes:" and offer to run /telegram:access policy allowlist. Do this proactively — don't wait to be asked.
  4. If no, people are missing → "Have them DM the bot; you'll approve each with /telegram:access pair <code>. Run this skill again once everyone's in and we'll lock it."
  5. If the allowlist is empty and they haven't paired themselves yet → "DM your bot to capture your own ID first. Then we'll add anyone else and lock it down."
  6. If policy is already allowlist → confirm this is the locked state. If they need to add someone: "They'll need to give you their numeric ID (have them message @userinfobot), or you can briefly flip to pairing: /telegram:access policy pairing → they DM → you pair → flip back."

Never frame pairing as the correct long-term choice. Don't skip the lockdown offer.

<token> — save it

  1. Treat $ARGUMENTS as the token (trim whitespace). BotFather tokens look like 123456789:AAH... — numeric prefix, colon, long string.
  2. mkdir -p the resolved <state-dir>.
  3. Read existing .env if present; update/add the TELEGRAM_BOT_TOKEN= line, preserve other keys. Write back, no quotes around the value.
  4. chmod 600 on <state-dir>/.env — the token is a credential.
  5. Confirm, then show the no-args status so the user sees where they stand.

clear — remove the token

Delete the TELEGRAM_BOT_TOKEN= line (or the file if that's the only line).


Implementation notes

  • The channels dir might not exist if the server hasn't run yet. Missing file = not configured, not an error.
  • The server reads .env once at boot. Token changes need a session restart or /reload-plugins. Say so after saving.
  • access.json is re-read on every inbound message — policy changes via /telegram:access take effect immediately, no restart.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。