Chat bot in php CLI

No because this is what twitch chat sends

Basically its

alias!user@hostname

See also Chat & Chatbots | Twitch Developers

> :<user>!<user>@<user>.tmi.twitch.tv PRIVMSG #<channel> :This is a sample message

And we usually extract the user from that string

IRC is a fairly old format so regex’s exist for tokenising.

Some examples at https://github.com/BarryCarlyon/twitch_misc/blob/master/chat/chat.js#L46 node JS examples of the Regex I use

or for PHP you can use an existing library such as SmartIRC

Might need some modifications to support IRCv3 though. But otherwise for unenhanced/capabilitied Twitch Chat should work just fine.