RITlug / teleirc

Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
https://docs.teleirc.com/
GNU General Public License v3.0
140 stars 45 forks source link

Fix Imgur Photo Uploading #93

Closed Tjzabel closed 5 years ago

Tjzabel commented 5 years ago

With #87 we've discovered imgur is not properly set up, and so therefore we get an error saying imgur is undefined.

In order to fix this, we need to implement proper Imgur photo uploading from Telegram to IRC. Here is my suggestion for how we move forward.

Steps to get Imgur Working

  1. Obtain Imgur API key.
  2. Either add image uploading to _UploadImage, or implement uploadUrl.
  3. Create test cases to test new implementation

Helpful links

Tjzabel commented 5 years ago

We may want to figure out a short-term change for #87, whether that be removing unused imgur calls, or commenting out the current unworking Imgur implementation.

jwflory commented 5 years ago

@Tjzabel Theoretically, we could merge #87 so master branch technically "works" again (this fixes the issue with #rit-foss and #ritlug for example). Before cutting a new release, we'd need to get to the bottom of this.

jwflory commented 5 years ago

Per discussion with @xforever1313 tonight, easiest way to do this is likely to handle it in constructor of Imgur class and set the environment variable there.

Tjzabel commented 5 years ago

@jwflory yeah we'll need to set the client ID in the env file and then pass it into the Imgur class.

I'm working on the upload function, and should have it by the end of the week unless someone finishes it before me.

jwflory commented 5 years ago

@Tjzabel Awesome! If you're already working on, I will assign this issue to you. :+1:

Tjzabel commented 5 years ago

Update

Imgur standalone implementation is just about complete.

(Updated) Next Steps

  1. Make TgImgurPhotoHandler.js use the imgur Client ID from the .env file.
  2. Fix imgur tests -- RITlug test images URLs don't exist
  3. ???
  4. Profit!
Tjzabel commented 5 years ago

... I had a confusion

(I've just provisioned my own teleirc test bot to test out these issues) In my infinite wisdom, I thought the imgur support was broken. After testing in my own environment, I have learned the opposite :smile: The imgur test cases fail, which had further confirmed my initial theory.

But now everything is all good!

It seems all we need to implement is the imgur client ID.

The client ID is the API key that is used to signal to imgur what application is making the calls. We should definitely be using the one in the .env file.

Also, the test cases are failing because the test images on RITlug's website (https://ritlug.com) do not contain these test images anymore.

My realization makes this issue much easier and quicker to solve. I am going to update the above roadmap.

Tjzabel commented 5 years ago

Imgur photo uploading works.