In this case, its true though. You have to be aware of the discord dynamics. Usually when someone messages you out of nowhere and asks you to join their discord... well, chances are they are either a spambot or a scammer.
I'm not saying you are one. It's just that situations like that on discord are so insanely common that people outright ban discord invites, ban people inviting others to discord or block them if they're lenient. I personally wouldn't have banned you but I'd block you.
That's usually how you avoid getting your account hijacked.