mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-20 23:43:07 +00:00
Compare commits
1 Commits
kenneth/te
...
kenneth/ch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14927ff475 |
@@ -55,7 +55,9 @@ Install the plugin:
|
|||||||
/discord:configure MTIz...
|
/discord:configure MTIz...
|
||||||
```
|
```
|
||||||
|
|
||||||
Writes `DISCORD_BOT_TOKEN=...` to `.claude/channels/discord/.env` in your project. You can also write that file by hand, or set the variable in your shell environment — shell takes precedence.
|
Writes `DISCORD_BOT_TOKEN=...` to `~/.claude/channels/discord/.env`. You can also write that file by hand, or set the variable in your shell environment — shell takes precedence.
|
||||||
|
|
||||||
|
> To run multiple bots on one machine (different tokens, separate allowlists), point `DISCORD_STATE_DIR` at a different directory per instance.
|
||||||
|
|
||||||
**6. Relaunch with the channel flag.**
|
**6. Relaunch with the channel flag.**
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { readFileSync, writeFileSync, mkdirSync, readdirSync, rmSync, statSync,
|
|||||||
import { homedir } from 'os'
|
import { homedir } from 'os'
|
||||||
import { join, sep } from 'path'
|
import { join, sep } from 'path'
|
||||||
|
|
||||||
const STATE_DIR = join(homedir(), '.claude', 'channels', 'discord')
|
const STATE_DIR = process.env.DISCORD_STATE_DIR ?? join(homedir(), '.claude', 'channels', 'discord')
|
||||||
const ACCESS_FILE = join(STATE_DIR, 'access.json')
|
const ACCESS_FILE = join(STATE_DIR, 'access.json')
|
||||||
const APPROVED_DIR = join(STATE_DIR, 'approved')
|
const APPROVED_DIR = join(STATE_DIR, 'approved')
|
||||||
const ENV_FILE = join(STATE_DIR, '.env')
|
const ENV_FILE = join(STATE_DIR, '.env')
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ Install the plugin:
|
|||||||
/telegram:configure 123456789:AAHfiqksKZ8...
|
/telegram:configure 123456789:AAHfiqksKZ8...
|
||||||
```
|
```
|
||||||
|
|
||||||
Writes `TELEGRAM_BOT_TOKEN=...` to `.claude/channels/telegram/.env` in your project. You can also write that file by hand, or set the variable in your shell environment — shell takes precedence.
|
Writes `TELEGRAM_BOT_TOKEN=...` to `~/.claude/channels/telegram/.env`. You can also write that file by hand, or set the variable in your shell environment — shell takes precedence.
|
||||||
|
|
||||||
|
> To run multiple bots on one machine (different tokens, separate allowlists), point `TELEGRAM_STATE_DIR` at a different directory per instance.
|
||||||
|
|
||||||
**4. Relaunch with the channel flag.**
|
**4. Relaunch with the channel flag.**
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { readFileSync, writeFileSync, mkdirSync, readdirSync, rmSync, statSync,
|
|||||||
import { homedir } from 'os'
|
import { homedir } from 'os'
|
||||||
import { join, extname, sep } from 'path'
|
import { join, extname, sep } from 'path'
|
||||||
|
|
||||||
const STATE_DIR = join(homedir(), '.claude', 'channels', 'telegram')
|
const STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join(homedir(), '.claude', 'channels', 'telegram')
|
||||||
const ACCESS_FILE = join(STATE_DIR, 'access.json')
|
const ACCESS_FILE = join(STATE_DIR, 'access.json')
|
||||||
const APPROVED_DIR = join(STATE_DIR, 'approved')
|
const APPROVED_DIR = join(STATE_DIR, 'approved')
|
||||||
const ENV_FILE = join(STATE_DIR, '.env')
|
const ENV_FILE = join(STATE_DIR, '.env')
|
||||||
@@ -372,11 +372,6 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|||||||
items: { type: 'string' },
|
items: { type: 'string' },
|
||||||
description: 'Absolute file paths to attach. Images send as photos (inline preview); other types as documents. Max 50MB each.',
|
description: 'Absolute file paths to attach. Images send as photos (inline preview); other types as documents. Max 50MB each.',
|
||||||
},
|
},
|
||||||
format: {
|
|
||||||
type: 'string',
|
|
||||||
enum: ['text', 'markdownv2'],
|
|
||||||
description: "Rendering mode. 'markdownv2' enables Telegram formatting (bold, italic, code, links). Caller must escape special chars per MarkdownV2 rules. Default: 'text' (plain, no escaping needed).",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
required: ['chat_id', 'text'],
|
required: ['chat_id', 'text'],
|
||||||
},
|
},
|
||||||
@@ -403,11 +398,6 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|||||||
chat_id: { type: 'string' },
|
chat_id: { type: 'string' },
|
||||||
message_id: { type: 'string' },
|
message_id: { type: 'string' },
|
||||||
text: { type: 'string' },
|
text: { type: 'string' },
|
||||||
format: {
|
|
||||||
type: 'string',
|
|
||||||
enum: ['text', 'markdownv2'],
|
|
||||||
description: "Rendering mode. 'markdownv2' enables Telegram formatting (bold, italic, code, links). Caller must escape special chars per MarkdownV2 rules. Default: 'text' (plain, no escaping needed).",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
required: ['chat_id', 'message_id', 'text'],
|
required: ['chat_id', 'message_id', 'text'],
|
||||||
},
|
},
|
||||||
@@ -424,8 +414,6 @@ mcp.setRequestHandler(CallToolRequestSchema, async req => {
|
|||||||
const text = args.text as string
|
const text = args.text as string
|
||||||
const reply_to = args.reply_to != null ? Number(args.reply_to) : undefined
|
const reply_to = args.reply_to != null ? Number(args.reply_to) : undefined
|
||||||
const files = (args.files as string[] | undefined) ?? []
|
const files = (args.files as string[] | undefined) ?? []
|
||||||
const format = (args.format as string | undefined) ?? 'text'
|
|
||||||
const parseMode = format === 'markdownv2' ? 'MarkdownV2' as const : undefined
|
|
||||||
|
|
||||||
assertAllowedChat(chat_id)
|
assertAllowedChat(chat_id)
|
||||||
|
|
||||||
@@ -452,7 +440,6 @@ mcp.setRequestHandler(CallToolRequestSchema, async req => {
|
|||||||
(replyMode === 'all' || i === 0)
|
(replyMode === 'all' || i === 0)
|
||||||
const sent = await bot.api.sendMessage(chat_id, chunks[i], {
|
const sent = await bot.api.sendMessage(chat_id, chunks[i], {
|
||||||
...(shouldReplyTo ? { reply_parameters: { message_id: reply_to } } : {}),
|
...(shouldReplyTo ? { reply_parameters: { message_id: reply_to } } : {}),
|
||||||
...(parseMode ? { parse_mode: parseMode } : {}),
|
|
||||||
})
|
})
|
||||||
sentIds.push(sent.message_id)
|
sentIds.push(sent.message_id)
|
||||||
}
|
}
|
||||||
@@ -495,13 +482,10 @@ mcp.setRequestHandler(CallToolRequestSchema, async req => {
|
|||||||
}
|
}
|
||||||
case 'edit_message': {
|
case 'edit_message': {
|
||||||
assertAllowedChat(args.chat_id as string)
|
assertAllowedChat(args.chat_id as string)
|
||||||
const editFormat = (args.format as string | undefined) ?? 'text'
|
|
||||||
const editParseMode = editFormat === 'markdownv2' ? 'MarkdownV2' as const : undefined
|
|
||||||
const edited = await bot.api.editMessageText(
|
const edited = await bot.api.editMessageText(
|
||||||
args.chat_id as string,
|
args.chat_id as string,
|
||||||
Number(args.message_id),
|
Number(args.message_id),
|
||||||
args.text as string,
|
args.text as string,
|
||||||
...(editParseMode ? [{ parse_mode: editParseMode }] : []),
|
|
||||||
)
|
)
|
||||||
const id = typeof edited === 'object' ? edited.message_id : args.message_id
|
const id = typeof edited === 'object' ? edited.message_id : args.message_id
|
||||||
return { content: [{ type: 'text', text: `edited (id: ${id})` }] }
|
return { content: [{ type: 'text', text: `edited (id: ${id})` }] }
|
||||||
|
|||||||
Reference in New Issue
Block a user