Negative reinforcement won’t work, not really. The key is in the positive. Be compassionate toward yourself because we will fail and it’s important that we fall onto a soft surface. These so-called ‘bad behaviours’ are simply actions that hinder you or clash with your ethics and values. If you want to be better you must forgive yourself or else you won’t progress.
Positively reinforce success. You don’t need to punish yourself because even in being gentle with yourself when you don’t succeed, the satisfaction and inherent reward of becoming consistent in your new behaviour patterns and joy of reward overshadow all and will motivate you to do better without the self-abuse.
Getting that taste of actually feeling yourself change and enjoy changing will work as a far better motivator than shaming and blaming yourself ever will. You will just become too scared of failure to even try, and assume all you can do is fail.
No one can change overnight, not really. You will fail. I fail all the time. These missteps are an action of learning and will make success so much sweeter.