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:
@@ -1,3 +1,4 @@
|
|||||||
|
import https from 'https';
|
||||||
import { Api, Bot } from 'grammy';
|
import { Api, Bot } from 'grammy';
|
||||||
|
|
||||||
import { ASSISTANT_NAME, TRIGGER_PATTERN } from '../config.js';
|
import { ASSISTANT_NAME, TRIGGER_PATTERN } from '../config.js';
|
||||||
@@ -53,7 +54,11 @@ export class TelegramChannel implements Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async connect(): Promise<void> {
|
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)
|
// Command to get chat ID (useful for registration)
|
||||||
this.bot.command('chatid', (ctx) => {
|
this.bot.command('chatid', (ctx) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user