fix: use https.globalAgent in grammY Bot to support sandbox proxy

grammY creates its own https.Agent internally, bypassing any global
proxy. In Docker Sandbox, NanoClaw sets https.globalAgent to a proxy
agent at startup. This tells grammY to use it instead. On non-sandbox
setups it's a no-op.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Gabi Simons
2026-03-11 22:46:57 +02:00
parent 2dedd15ec7
commit d000acc687

View File

@@ -1,3 +1,4 @@
import https from 'https';
import { Api, Bot } from 'grammy';
import { ASSISTANT_NAME, TRIGGER_PATTERN } from '../config.js';
@@ -53,7 +54,11 @@ export class TelegramChannel implements Channel {
}
async connect(): Promise<void> {
this.bot = new Bot(this.botToken);
this.bot = new Bot(this.botToken, {
client: {
baseFetchConfig: { agent: https.globalAgent, compress: true },
},
});
// Command to get chat ID (useful for registration)
this.bot.command('chatid', (ctx) => {