Right-click the spam messages and report them. This helps Discord's Trust & Safety team ban the underlying "botnet."
Use bots like MEE6 or Wick to require new members to complete a CAPTCHA or click a button before they can see channels.
Here are some helpful papers, articles, and tools to combat spam on Discord: