Discord js - client.invite.acceptInvite(code)

Do somebody knows how accept invite through js code? client.invite.acceptInvite(code) has been obsoleted, but there are other ways to do that.