Conviction from the holy Spirit

Hi, I am new to this subreddit, I wanted to ask about the conviction. When the holy Spirit convicts you, does it happen after you sin or can it happen at any time? Generally, after I sin I feel guilt, maybe. That feeling I had drew me farther from God. Except for yesterday, I think. I fell into sexual sin and felt regretful. I was also disappointed in myself, as I kept asking myself "Why did you do it? You just had to sin, didn't you? You didn't have to and yet you did".

Among other things too, I was angry at myself. Every now and then, I get a desire or motivation to do what I believe is right. To read my Bible, to repent, to do things that I know will please God. Would that be considered conviction? I ask because I am scared that I have been ignoring it not knowing that it is conviction from the Holy Spirit, I don't want to reject Him.