The consensus problem for leader-following multi-agent systems with general dynamics via event-triggered and self-triggered mechanisms is studied. In the practical leader-following systems, not all followers can access the information of the leader directly, so the agents are divided into two categories according to whether they receive the information of the leader directly or not. For the former, the authors only utilise the leader's state and its own state information to design the distributed consensus protocol, even if there are other neighbours. To achieve the consensus problem that each follower can ultimately track the state of the leader over time, two kinds of event-triggered control schemes are designed for two types of agents, respectively. It is shown that the systems can achieve the consensus problem by utilising the event-triggered mechanisms through a theorem. In this case, Zeno behaviour can be excluded. Furthermore, the self-triggered control algorithm is also proposed to avoid continuous communication with neighbours and there is no Zeno behaviour in the systems. Finally, two examples are used to verify the validity of the main results.