WoW:API SpellStopCasting

Stops the current spellcasting. Doesn't work for channeled spells.
Returns nil if it didn't do anything (no spell was being cast at the moment), 1 if it did stop a casting.

Can disable autorepeated "spells", like hunter's Auto shot.