PostgreSQL - how to recognize if function was called by delete or update trigger?
Assuming this is a PL/pgSQL function, then - as documented in the manual - a trigger function automatically has access to some special variables. One of them is TG_OP that identifies the trigger operation. 

The manual even has an example on how to use it:

IF (TG_OP = 'DELETE') THEN
  -- do something with the OLD record
ELSIF (TG_OP = 'UPDATE') THEN
  -- do something with the NEW record
ELSIF (TG_OP = 'INSERT') THEN
  -- do something entirely different
END IF;