But that IRC archive was written by a bot, not the server(s). Adding a bot to Discord is just as easy.
From there it's no longer a Discord problem, as you just need to export that data somewhere. There's bots which already partialy do this. There's bots that log edits & deletes for moderators to review and bots like TicketTool (https://tickettool.xyz/) let you create special one-off channels (tickets) that you can export to html on closure too.