From this video
https://www.youtube.com/watch?v=6WErujpPS6g
Just blocks the command when the player has no class, tested quickly on my server~ I expect this to get fixed quickly but have fun. I looked and couldn't see anyone else post a fix yet.
Edit: This was fixed on the 03-01-2023 TF2 update, but it is still possible to spam the command and the accompanying sound cue, which this plugin fixes.