I think it would be good to run the gif saving in a non-blocking thread as well so this can be reused.
def to_thread(func: Callable) -> Coroutine:
"""Helper to make these blocking functions cast to threads since they are really slow and cause Discord to freak out."""
@functools.wraps(func)
async def wrapper(*args, **kwargs):
return await asyncio.to_thread(func, *args, **kwargs)
return wrapper
I think it would be good to run the gif saving in a non-blocking thread as well so this can be reused.