Write a wrapper for input message before hitting any action

I have been working on rasa and I need the following functionalities. Any help would be great.

Scenario–1: When a user enters a message, I need to check for any ‘mean’ word and if the message has that word i need to take the user to action_default_fallback or say “Sorry I did not understand”. No matter of the intent predicted, if the user message has a mean word, i need do the above.

Right now I am implementing this in all the actions independently and want to make it as a reusable code.

Scenario–2: I have a set of commands like, a 1000 in a external json file as keys and appropriate response as the value. Now, no matter of the intent, if the user has entered an exact command, I need to check in the json file and respond back the respective message if the command is present.

Currently Iam implementing this independently in every action, checking the tracker.latest messsage for the command as a function.

Is there a way to create a function which will get run before going into any action. Or else can we use the function decorators concept on the run method of action file ?..tried to implement the function decorator and got the error

“You can only register functions that take 3 parameters as arguments. The three parameters your function will receive are: dispatcher, tracker, domain. Your function accepts only 2 parameters.”

Implemented function decorator code is:

Decorator function:

def check_mean_word(func):
    def inner(*args,**kwargs):
        print('Before calling the function.')
        func(*args,**kwargs)
        print('After calling the function.')
    
    return inner

Action File Code:

class report_creat(Action):
    def name(self):
        return "action_report_create"

    @check_mean_word
    def run(self, dispatcher, tracker, domain):
        message = tracker.latest_message['text']

Please let me know for any. Thanks for the help in advance.