It seems this happens occasionally on #fedi where malicious users decide to take advantage of instances with poor moderation to spam widely.
There are many solutions, but let me offer a simple change that stops spam dead in its tracks:
#nodebb has a post queue built in. If you have 0 reputation, you need your post to be manually approved. You can adjust this as needed, but even the default (allow regular posting after 1 upvote) is sufficient. Stops 👏spam 👏 cold 👏.
We also have integrated project honeypot, akismet, and captcha, but those are passive technologies that can be worked around given time.
But simple is best — raise the bar of contribution just a tiny bit, and the effect on spam is huge. To get around a post queue, spammers have to make a quality contribution, and that's hard when spam accounts are automated by script.
Does #mastodon support any of this?