I would refer you to use the
CLEU, but then again it depends on what you try to achieve.
But you are right that UnitCastingInfo and UnitChannelInfo don't return a spellID, so you can always try match the spell name instead. Like "if text == GetSpellInfo(12345) then" you get the idea.