ESN-Trondheim / ESNbot

A Slack bot for ESN Trondheim
MIT License
3 stars 2 forks source link

Show response when trying to delete file #70

Open LaiAlexander opened 1 year ago

LaiAlexander commented 1 year ago

When trying to delete files in watermark and coverphoto, it gets logged to console that the file is deleted. The bot also writes in chat that the uploaded pictures will be deleted.

Should instead get the response from the delete request, and use this to see if it's actually successfully deleted or not. https://github.com/ESN-Trondheim/ESNbot/blob/cfc0bd24ae3d89333d7ce434d639fd7794e00cbb/esnbot/main.py#L224-L231

Should add in something like this (pseudocode):

log_to_console(str(res))
if (res["ok"])
    log_to_console("Successfully deleted")
    return 1
else:
    log_to_console(res["error"])
    return -1

Could use booleans to return if it was a success or not, but we probably should return the error as well.

The bot can then respond with the error. Or simply just inform that it will try to delete the file.

This also of course raises the question if the file should be deleted at all? The deleting was originally implemented because of storage limits on Slack's free plan. I don't think this is an issue anymore, afaik older files will just be inaccessible.