Ele espera objetos compatíveis com a interface moderna Dispatcher, que possuem o método dispatch().
Ou seja, o Baileys estava recebendo um tipo de agente incompatível com o novo sistema de rede do Node.
Foi criada uma nova função makeProxyAgentUndici() para gerar agentes de proxy compatíveis com o Undici, mantendo a versão antiga (makeProxyAgent()) inalterada para compatibilidade com bibliotecas como Axios.
A nova função substitui os antigos HttpsProxyAgent e SocksProxyAgent por ProxyAgent da biblioteca undici, garantindo compatibilidade total com o Baileys e com qualquer uso de fetch() moderno.
In some tests made on the testProxy function, the `new ProxyAgent()` was not working, even adding it the IP result was the same.
I've change it to the `new HttpsProxyAgent()` and it worked.
Refactored the proxy agent to center the same function/creation the same where it is used