Jintaku-Cogs-V3 icon indicating copy to clipboard operation
Jintaku-Cogs-V3 copied to clipboard

Test gifs at startup

Open Sandvich opened this issue 3 years ago • 0 comments

So to deal with the issue of dead links, it would be good to have some kind of automatic test that checks for and removes dead links at startup/cog loading. But I'm not that good at the async stuff, so I could use some help with this.

My current thought is that, in the __init__ function for roleplay, we could have something like this at the end:

for command in default_global.keys():
    new_gif_list = []
    for gif in default_global[command]:
        code = requests.get(gif).status_code
        if code < 400:
            new_gif_list.append(gif)
    default_global[command] = new_gif_list
self.config.register_global(**default_global)

Of course, I'd like to remove the dependency on requests and also make this asynchronous, but as I say, I'm not that great with async. I'd appreciate any help!

Sandvich avatar Mar 27 '21 20:03 Sandvich