@ebowwa/channel-telegram 1.13.5 → 1.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/toolsoutput.ts +0 -50
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* /toolsoutput command - Toggle tool output messages
|
|
3
|
-
*
|
|
4
|
-
* When disabled, tools still execute but their output isn't sent to Telegram
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import TelegramBot from 'node-telegram-bot-api';
|
|
8
|
-
import { ConversationMemory } from '../conversation-memory';
|
|
9
|
-
import type { Tool } from '../types';
|
|
10
|
-
|
|
11
|
-
// Global state for tool output visibility
|
|
12
|
-
let toolOutputEnabled = true;
|
|
13
|
-
|
|
14
|
-
export function isToolOutputEnabled(): boolean {
|
|
15
|
-
return toolOutputEnabled;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function registerToolsOutputCommand(
|
|
19
|
-
bot: TelegramBot,
|
|
20
|
-
_memory: ConversationMemory,
|
|
21
|
-
_tools: Tool[]
|
|
22
|
-
): void {
|
|
23
|
-
bot.onText(/\/toolsoutput(?:\s+(on|off|toggle))?/, async (msg: TelegramBot.Message, match: RegExpExecArray | null) => {
|
|
24
|
-
const chatId = msg.chat.id;
|
|
25
|
-
const subCommand = match?.[1]?.toLowerCase();
|
|
26
|
-
|
|
27
|
-
if (subCommand === 'on') {
|
|
28
|
-
toolOutputEnabled = true;
|
|
29
|
-
} else if (subCommand === 'off') {
|
|
30
|
-
toolOutputEnabled = false;
|
|
31
|
-
} else {
|
|
32
|
-
// toggle or no arg = toggle
|
|
33
|
-
toolOutputEnabled = !toolOutputEnabled;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const status = toolOutputEnabled ? 'ON' : 'OFF';
|
|
37
|
-
const emoji = toolOutputEnabled ? '🔊' : '🔇';
|
|
38
|
-
|
|
39
|
-
await bot.sendMessage(
|
|
40
|
-
chatId,
|
|
41
|
-
`${emoji} *Tool Output: ${status}*\n\n` +
|
|
42
|
-
`Tool execution messages are now ${toolOutputEnabled ? 'visible' : 'hidden'}.\n\n` +
|
|
43
|
-
`Commands:\n` +
|
|
44
|
-
`/toolsoutput on - Enable tool messages\n` +
|
|
45
|
-
`/toolsoutput off - Disable tool messages\n` +
|
|
46
|
-
`/toolsoutput toggle - Toggle`,
|
|
47
|
-
{ parse_mode: 'Markdown' }
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
}
|