How can you tell if it's really a god talking to you, and not, say, your own subconscious mind?
Here's one useful question to ask.
The Muslim über-prophet Muhammad was well-known for the self-serving nature of his revelations. Whenever a problem would arise in the early 'umma, Muhammad would go up to the mountain and come down again with a divinely-revealed solution.
Guess who Allah always agreed with?
Muhammad's favorite wife 'Aisha once said to him: Isn't it interesting how Allah always backs you in every argument?
How can you tell when it's really a god talking to you?
Ask yourself: Does the god agree with me?
If the answer is Yes, then the answer is probably No.