Reviling Allah or reviling Islam constitutes kufr and apostasy from Islam, according to scholarly consensus. The one who does that has to repent sincerely to Allah, by regretting what has happened and resolving not to go back to it again. If he repents, Allah will accept his repentance. Allah, may He be exalted, says (interpretation of the meaning):
Say: O Ibaadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allaah, verily, Allaah forgives all sins. Truly, He is Oft‑Forgiving, Most Merciful
It was narrated from Abu Moosa (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: Allaah holds out His hand at night to accept the repentance of those who have sinned during the day, and He holds out his hand by day to accept the repentance of those who have sinned at night - until the sun rises from its place of setting.
Narrated by Muslim, 2759.
So you have to repent, turn to Allah and do a lot of righteous deeds. As for thinking about whether this reviling was done deliberately or not, this is whispers from the Shaytaan who wants to distract you from repenting or weaken your fear of Allah and your efforts to do righteous deeds. If you understand the abhorrent nature of what you did, and its grave seriousness, that will make you strive to do good and will generate in your heart feelings of submission and humility before Allah; it will make you pin your hopes on His grace, kindness and forgiveness. But if your nafs makes falsehood appealing to you, and makes the offence seem less serious by claiming that it was done in a state of anger, then this will weaken your resolve and lessen your desire to turn to Allah.
You should understand that the kind of anger that causes a person to lose his mind, that a person may be excused for, is that which causes him to lose the ability to distinguish matters to such an extent that he does not know what he is saying. If this happens once, it does not happen repeatedly. Many of those who have the problem of reviling Islam, or reviling Allah or reviling His Messenger (blessings and peace of Allah be upon him) would not be able to revile their fathers or a person whom they hold in high esteem or the father of his opponent and the like, no matter how intense his anger is, but he can revile Islam because of the lack of faith in his heart and his lack of respect for Allah and for His messenger and His religion. We ask Allah to keep us safe and sound. If there were any faith in the heart of such a person, it would prevent him from speaking in this abhorrent manner. Hence we say: Ignore this waswaas, for you have committed the greatest evil, but you have a Lord Who is Most Merciful and Most Kind; He accepts the repentance of the penitent, forgives the sinner, and turns bad deeds into good. So make your resolve firm, fill your heart with respect for Allah, may He be exalted, and respect for His religion, and read a great deal of Qur'aan and do a lot of righteous deeds.
We ask Allah to accept your repentance and forgive you your sins.
And Allah knows best.
Reproduced from Islam QA