nathanj / spirit-island-pbp

Spirit Island PBP Helper
4 stars 7 forks source link

Send card photo info when gaining any card #71

Open TheOriginalSoni opened 2 weeks ago

TheOriginalSoni commented 2 weeks ago

As of now, the bitcrafter only sends the name of all gained cards to the Discord bot half. And the discord bot separately takes all the images from the main folder and generates the combined images.

It might be better to send the images to the discord bot (via giving redis(?) URLs).

This will allow the main discord bot instance to support custom bitcrafter instances as well. As of now, each bitcrafter instance requires its own discord bot alongside it.

TheOriginalSoni commented 2 weeks ago

Probably not an important issue at all, but it'll give us flexibility to add more features and support in this later on

petertseng commented 2 weeks ago

I don't understand the facts of the description, because https://github.com/nathanj/spirit-island-pbp/blob/08063c95bdd1053ca85641f794646273738e34a2/pbf/views.py#L533-L535 seems to contradict the statement "only sends the name". Since the image paths are being sent, I can't reconcile that with a claim that it only sends the name. I think the description of this issue is factually incorrect.

But I'm willing to set aside the above and instead look for solutions. So if it's insufficient to send a relative path, one might consider sending an absolute path. I would like to suggest that as a solution.

I am proposing that as a solution because if there are two instances of the website that have different images for a same-named card, clearly they also have different image directories. That suggests to me that the contract should be that each instance of the website should be expected to send the correct path to the bot by putting it in images. The bot will thereby use the correct image corresponding to the website that sent it that log message.

This proposed solution will work for the case of one bot that sends images for two (or more!) instances of the website, both running on the same machine as the bot.