I wrote one for my forum that does basically what you want it to do.
But I haven’t really shared it here because it’s pretty specific to my needs, not tested to the degree it should be and probably overkill. It copies over every discord message to a table in the forum db which I use to calculate post count and award ranks.
You can also check out this one Discord Bot Construction Kit 🤖