Rather than expecting people to stop saying demotivating things to you, better start learning to ignore demotivating things said to you. And for that, it's important to build confidence from your own strengths.
No one knows everything; so as you. No one can be perfect; so as you. No one can be right always, so as you. But there have been great achievers; so can be you.