DiscordChatExporter icon indicating copy to clipboard operation
DiscordChatExporter copied to clipboard

Display server invites like it's done in Discord

Open CanePlayz opened this issue 3 years ago • 3 comments

Flavor

No response

Export format

HTML

Details

I have no clue if that's even doable with the data you can get from the Discord API and so on, but my idea here was to display the preview for server invites a bit more like it's done in Discord itself.

(for reference, here's how it looks on Discord) image

(and in the HTML file it's just blank currently) image

(the link obviously doesn't work anymore xD)

CanePlayz avatar Jul 14 '21 21:07 CanePlayz

Yeah, not sure if there's any detailed information on the invite coming from the API. Will have to investigate.

Tyrrrz avatar Jul 15 '21 15:07 Tyrrrz

@Tyrrrz the /invites/{invite_code} endpoint exists https://discord.com/api/invites/djs?with_counts=true

Fyko avatar Jul 17 '21 22:07 Fyko

@Tyrrrz the /invites/{invite_code} endpoint exists discord.com/api/invites/djs?with_counts=true

Nice!

Tyrrrz avatar Jul 18 '21 11:07 Tyrrrz

I think the best way to implement this is by adding a check in the link handler in the HTML markdown visitor:

https://github.com/Tyrrrz/DiscordChatExporter/blob/e00f126a5e39bcfed6f8fc405690d8b29b343676/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs#L110-L130

We already check for message links and emit special-case HTML, so we can do the same for invite links.

Tyrrrz avatar Feb 06 '23 12:02 Tyrrrz

Added basic support for invite links, where it renders the guild icon, guild name, and channel name. Discord client currently renders online/total member count instead of channel name, but I feel like the former is more useful in an export.

Tyrrrz avatar Feb 14 '23 19:02 Tyrrrz

Great, thanks. 👍

CanePlayz avatar Feb 14 '23 19:02 CanePlayz