To summarise: “gg” might mean any of “have a nice game”, “well played”, “please resign you loser”, “my keyword is broken only the ‘g’ key works”
Avoiding the ambiguity is as simple as taking the time to type the full sentence, “thank you for the game”.
Added bonus: your opponent will appreciate that you bothered to type in a full proper sentence! In today’s world of short-attention-span, it shows a very high mark of respect.