You probably want to test the this-command
variables.
e.g. C-u M-x apropos-variable RET this RET
:
real-this-command
This is like `this-command', except that commands should never
modify it.
this-command
The command now being executed.
this-command-keys-shift-translated
Non-nil if the key sequence activating this command was
shift-translated.
this-original-command
The command bound to the current key sequence before remapping.