The game would need to have a connection to Twitch Chat from which is can read what users are saying in chat, and also send whispers to the users.
One important thing to keep in mind though is that it’s generally considered bad design to respond to messages through a different method than which they came in on, eg if a message is sent in chat it should be replied to in chat, and if a message is sent as a whisper it should be replied to in a whisper. If your bot were to be the one initiating lots of whispers, potentially with similar/duplicate messages, it would likely get either banned or have whispers disabled due to Twitch’s anti-spam features.
A much better solution which would leave chat free of spam, both from a bot and from users trying to use commands and also avoid the issue of your bot being marked as a spammer, would be to create a Twitch Extension and do the functionality you want through that.