The documented way to handle whispers is using PubSub, not IRC: https://dev.twitch.tv/docs/PubSub#subscribing-to-topics
There was/is an undocumented way to do it in IRC, and you can see here: Whispers on IRC
I have no idea if the IRC way still works anymore, last time I messed around with it was probably about a year ago