Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test gifs at startup #58

Open
Sandvich opened this issue Mar 27, 2021 · 0 comments
Open

Test gifs at startup #58

Sandvich opened this issue Mar 27, 2021 · 0 comments

Comments

@Sandvich
Copy link
Contributor

Sandvich commented Mar 27, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant