def add_to_cache()

in bot/discord_cache.py [0:0]


def add_to_cache(url: str) -> bytes:
    file_path = _get_file_name(url)
    if file_path.is_file():
        return file_path.read_bytes()

    attachment = requests.get(url, allow_redirects=True)
    attachment.raise_for_status()

    with open(file_path, mode="wb") as file:
        file.write(attachment.content)
    return attachment.content