Keypress to function

I know this sounds really simple, but is there any way I can implement a key press to a function, I know this is wrong, but you’ve got an idea then:

butmute.keyPress(“m”) = function {

Thanks

MDB