jp00p / AGIMUS

Discord bot for Friends of Desoto
MIT License
10 stars 9 forks source link

Fixes For Wishlist Timeouts, Misc Timestamps, and Correct Channel for Server Logs #453

Closed zmattingly closed 9 months ago

zmattingly commented 9 months ago

Address Wishlist Timeouts

This hopefully addresses problems that have been cropping up with /wishlist matches and /wishlist dismissals:

image

Seems to have been caused with some changes in the latest pycord version in how interaction messages are stashed, so trying to delete the original message on the Dismissal and Revoke button callbacks was causing 404s since it couldn't locate them.

So, now we're opting to use the new interaction.edit() convenience method to just replace the contents of the message the button was attached to with the success message rather than previously where we were deleting the existing message and creating a whole new message response.

Subclassing pages.Paginator's on_timeout method

There's an open issue where if an original paginator message is dismissed (if it was ephemeral) or otherwise edited/deleted, when the on_timeout method is kicked off to disable the paginator's UI elements, it also encounters a 404 because the original message is no longer present. Per a help thread on the pycord discord server, I'm just wrapping the on_timeout in an except/pass for the time being, it sounds like they'll be adding a parameter to address this in an upcoming release.

Force Timestamps to use UTC -> Pacific Timezone Info

I feel like this is verbose but it's what I've come up with to try to ensure that the timestamps for /slots jackpots, /aliases, and show_leave_message() report durations/etc in a mostly sane way(!?!) 🤷

Use config["server_logs_channel"] in handlers/server_logs.py

Looks like we were relying on a global variable which doesn't seem to be present here anymore, so explicitly loading the config option to send these messages again (#captains-log)