therealguy90 / foundrytodiscord

A FoundryVTT module that sends all FoundryVTT messages to a Discord webhook.
https://ko-fi.com/loki123
MIT License
15 stars 2 forks source link

Request: Sending Images to Discord #31

Closed Berytak closed 8 months ago

Berytak commented 8 months ago

Hey there,

at the moment, I'm having an option to send different pages or journal entries to Discord, wich works really well, except for images. I'll just get the image link postet in Discord, which of course can't be resolved. Is this even possible to send images from Foundry to Discord? If this is feasible, it would be nice if you could consider implementing it.

Cheers Berytak

therealguy90 commented 8 months ago

By images in journal pages, you mean images that are embedded as <img></img> on journal entries? If so, that's not supported, and you'll have to popout the image to Send to Discord. This is what it should look like:

image

Journal pages of "image" type should be supported, too.

There is a limitation, though, Discord only embeds images that are of format: JPG, PNG, WEBP, or GIF. If it's not any of these, it can't be embedded onto a message.

Berytak commented 8 months ago

This seems odd, I guess than it is something Warhammer specific. I clicked the image in the journal and after that I clicked "Send Image" on the new window (the yellow marked one). image

In Discord it looks like this ... image

therealguy90 commented 8 months ago

Ah, I found your problem. Remove the /join/ from your invite link module setting. It should fix it.

edit: This should also fix the discord avatar not appearing on the message.

Berytak commented 8 months ago

Found the configuration, but sadly that didn't help.

image

The interesting part about it is, that in the module it's stated that I should test it with the defaultavatar.png. That works like a charm. Even the above postet URL to the image work in my browser ... so I might be missing something...

therealguy90 commented 8 months ago

Oh, I've seen this problem before. It's probably your certificate. Discord doesn't recognize your webpage as secure, which might require adding a chain PEM file to your web certificate. Not sure how to do that with duckdns, but give it a shot.

I think most people use Let's Encrypt for it.

Berytak commented 8 months ago

No-IP offers my dynamic IP to URL service, because ISP only offers dynamic IPs. For their paid service they include a certificate chain which is issued by DigiCert, so no self signed certificate. This is a regular trusted SSL certificate and Foundry loads the whole chain. Nevertheless, this was this a good hint. I'll try searching in this direction, maybe I can find something useful, because it's very likely a Discord Issue.

Thanks for your help 👍

therealguy90 commented 8 months ago

Oh, it's No-IP, somehow my brain read ddns as duckdns. Nevertheless, yeah, it's a Discord issue at that point, since web browsers can load the resources from your Foundry server but not Discord, and the API is a little finicky with what it allows. Personally, I use a network tunnel (Tailscale and/or Playit.gg), since my ISP also only gives me a dynamic IP address. Those work fine for Foundry to Discord.

Berytak commented 8 months ago

Just found the culprit. When blocking the Discord server from accessing my web server due to a not whitelisted region, this error might occur ... lol Appreciate your help again, because without you nudging me in the right direction, I wouldn't have found the solution.