From my experience with CSGO, considering Blizzard seem to be a lot more throgough, if you've used the cheat at any time, even for 5 minutes then never use it again, if the hack ever becomes detected you run a risk of being banned. Blizzard generally enforce life time bans, so even if you buy another account it has a chance to be banned. You can be banned through being reported when players suspect you of cheating. Detection of the cheat comes down to the games anti-cheat or manual cheat investigations noticing a program reading and/or writing to the games memory and they find commonalities with it and others who have used it and ban accordingly.