UniversityOfHelsinkiCS / toska-silta

Minttuinen discord silta
0 stars 4 forks source link

Fix image bridge from slack to discord #4

Open Jakousa opened 3 years ago

Jakousa commented 3 years ago

Slack - discord is missing the text sent with image. Only image is bridged. Fix pls

ashutoshdhande commented 3 years ago

This is my first time in open source I will try my best to work on your issue. Just a little suggestion please add a ReadMe.md

sasumaki commented 3 years ago

make a PR about readme

ZeroDayOwl commented 3 years ago

Already made one, please check the PR #16

ashutoshdhande commented 3 years ago

Just Forked it, will try for "Fix image bridge from slack to discord"

Jakousa commented 3 years ago

Hey @ashutoshdhande, developing with a bridge from slack / discord can be a pain in the ass since you'll need to create guilds and slack and configure the bots. We seem to be having some trouble with the following code:

https://github.com/UniversityOfHelsinkiCS/toska-silta/blob/4d5feab657898e0c6a7f2e9d6087c25fd824a358/routerSlackToDiscord.js#L13-L22

It barely works. We'd love to use discord.js instead of FormData to send the data. This is what we tried:

https://github.com/UniversityOfHelsinkiCS/toska-silta/blob/ab6a1fe12b347fb2aa9a10c8939958f0163183c7/routerSlackToDiscord.js#L14-L21

Even though the url is passed correctly it does not bridge the file.

According to https://discord.js.org/#/docs/main/stable/class/Webhook?scrollTo=send example something like

webhook.send({
  files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']
})

should work, but the urls from slack do not seem to work. We fetch the data from https://api.slack.com/methods/files.info

Since @Darake noticed these issues I will create a few smaller issues that should be easier to fix by eyeballing the code and may not require a local development environment. Since this tool is atm only used by our team and I don't see much traffic here, we don't mind if your PR code isn't tested in any way.