ivandardi / RustbotPython

A Discord bot for the Community Rust Language server, written in Python.
MIT License
16 stars 9 forks source link

Edit playground responses when input edited #13

Closed ThatsNoMoon closed 4 years ago

ThatsNoMoon commented 4 years ago

This makes ferris edit responses to ?play, ?playwarn, and ?eval when the input message was edited. This allows for easy fixing of accidental errors and changing play to playwarn.

khionu commented 4 years ago

Almost LGTM, needs a timeout for listening to edits, otherwise the messages it's listening for will grow endlessly.

ThatsNoMoon commented 4 years ago

I.E. cache invalidation? I thought about it but didn't think it would be a big deal. It looks like the various playground commands have been used about 250 times over the past month, not including ones that got deleted, so I'll guess 350 times. Ideally, that dict would be about 5KiB after 350 usages. At that rate, it would take about 15 years to take up 1MiB. Obviously napkin math but I hope my point stands. I'll add code to remove messages that have been deleted now, since that shouldn't be that hard, but I would rather not try to figure out a good cache invalidation strategy unless it is really deemed necessary. I think it would require a lot more code complexity for not that much benefit, but I'll think about something I could work out.

khionu commented 4 years ago

@ivandardi cough cough