Fix webhook ip

This commit is contained in:
2022-03-14 20:35:23 +03:00
parent 5e472c590f
commit 3d828ec976
2 changed files with 6 additions and 2 deletions

View File

@@ -110,12 +110,15 @@ export default class BotsManager {
static async _setWebhook(bot: Telegraf, state: BotState): Promise<boolean> {
const dockerIps = (await dockerIpTools.getContainerIp()).split(" ");
const filteredIp = dockerIps.filter((ip) => ip.startsWith(env.NETWORK_IP_PREFIX));
for (const dockerIp of dockerIps) {
const ips = filteredIp.length !== 0 ? filteredIp : dockerIps;
for (const ip of ips) {
try {
await bot.telegram.setWebhook(
`${env.WEBHOOK_BASE_URL}:${env.WEBHOOK_PORT}/${state.id}/${bot.telegram.token}`, {
ip_address: dockerIp,
ip_address: ip,
}
);
return true;