# Buggy code
async def _storage(self, ctx: commands.Context, *, level: int = None):
    """Sets the caching level.

    Level can be one of the following:

    0: Disables all caching
    1: Enables Spotify Cache
    2: Enables YouTube Cache
    3: Enables Lavalink Cache
    5: Enables all Caches

    If you wish to disable a specific cache use a negative number.

    """
    current_level = CacheLevel(await self.config.cache_level())
    spotify_cache = CacheLevel.set_spotify()
    youtube_cache = CacheLevel.set_youtube()
    lavalink_cache = CacheLevel.set_lavalink()
    has_spotify_cache = current_level.is_superset(spotify_cache)
    has_youtube_cache = current_level.is_superset(youtube_cache)
    has_lavalink_cache = current_level.is_superset(lavalink_cache)

    if level is None:
        msg = (
            "---"
            + _("Cache Settings")
            + "---        \n"
            + _("Max age:          [{max_age}]\n")
            + _("Spotify cache:    [{spotify_status}]\n")
            + _("Youtube cache:    [{youtube_status}]\n")
            + _("Lavalink cache:   [{lavalink_status}]\n")
        ).format(
            max_age=str(await self.config.cache_age()) + " " + _("days"),
            spotify_status=_("Enabled") if has_spotify_cache else _("Disabled"),
            youtube_status=_("Enabled") if has_youtube_cache else _("Disabled"),
            lavalink_status=_("Enabled") if has_lavalink_cache else _("Disabled"),
        )
        await ctx.send(
            embed=discord.Embed(
                colour=await ctx.embed_colour(), description=box(msg, lang="ini")
            )
        )
        return await ctx.send_help()
    if level not in [5, 3, 2, 1, 0, -1, -2, -3]:
        return await ctx.send_help()

    removing = level < 0

    if level == 5:
        newcache = CacheLevel.all()
    elif level == 0:
        newcache = CacheLevel.none()
    elif level in [-3, 3]:
        if removing:
            newcache = current_level - lavalink_cache
        else:
            newcache = current_level + lavalink_cache
    elif level in [-2, 2]:
        if removing:
            newcache = current_level - youtube_cache
        else:
            newcache = current_level + youtube_cache
    elif level in [-1, 1]:
        if removing:
            newcache = current_level - spotify_cache
        else:
            newcache = current_level + spotify_cache
    else:
        return await ctx.send_help()

    has_spotify_cache = newcache.is_superset(spotify_cache)
    has_youtube_cache = newcache.is_superset(youtube_cache)
    has_lavalink_cache = newcache.is_superset(lavalink_cache)
    msg = (
        "---"
        + _("Cache Settings")
        + "---        \n"
        + _("Max age:          [{max_age}]\n")
        + _("Spotify cache:    [{spotify_status}]\n")
        + _("Youtube cache:    [{youtube_status}]\n")
        + _("Lavalink cache:   [{lavalink_status}]\n")
    ).format(
        max_age=str(await self.config.cache_age()) + " " + _("days"),
        spotify_status=_("Enabled") if has_spotify_cache else _("Disabled"),
        youtube_status=_("Enabled") if has_youtube_cache else _("Disabled"),
        lavalink_status=_("Enabled") if has_lavalink_cache else _("Disabled"),
    )
    await ctx.send(
        embed=discord.Embed(
            colour=await ctx.embed_colour(), description=box(msg, lang="ini")
        )
    )

    await self.config.cache_level.set(newcache.value)


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3183, in play
await self._enqueue_tracks(ctx, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3885, in _enqueue_tracks
result, called_api = await self.music_cache.lavalink_query(ctx, player, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/apis.py", line 911, in lavalink_query
results = await player.load_tracks(query)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 300, in load_tracks
self.__check_node_ready()
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 268, in __check_node_ready
raise RuntimeError("Cannot execute REST request when node not ready.")
RuntimeError: Cannot execute REST request when node not ready.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 728, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: Cannot execute REST request when node not ready.```

# Fixed code
async def _storage(self, ctx: commands.Context, *, level: int = None):
    """Sets the caching level.

    Level can be one of the following:

    0: Disables all caching
    1: Enables Spotify Cache
    2: Enables YouTube Cache
    3: Enables Lavalink Cache
    5: Enables all Caches

    If you wish to disable a specific cache use a negative number.
    """
    current_level = CacheLevel(await self.config.cache_level())
    spotify_cache = CacheLevel.set_spotify()
    youtube_cache = CacheLevel.set_youtube()
    lavalink_cache = CacheLevel.set_lavalink()
    has_spotify_cache = current_level.is_superset(spotify_cache)
    has_youtube_cache = current_level.is_superset(youtube_cache)
    has_lavalink_cache = current_level.is_superset(lavalink_cache)

    if level is None:
        msg = (
            _("Max age:          [{max_age}]\n")
            + _("Spotify cache:    [{spotify_status}]\n")
            + _("Youtube cache:    [{youtube_status}]\n")
            + _("Lavalink cache:   [{lavalink_status}]\n")
        ).format(
            max_age=str(await self.config.cache_age()) + " " + _("days"),
            spotify_status=_("Enabled") if has_spotify_cache else _("Disabled"),
            youtube_status=_("Enabled") if has_youtube_cache else _("Disabled"),
            lavalink_status=_("Enabled") if has_lavalink_cache else _("Disabled"),
        )
        await self._embed_msg(
            ctx, title=_("Cache Settings"), description=box(msg, lang="ini")
        )
        return await ctx.send_help()
    if level not in [5, 3, 2, 1, 0, -1, -2, -3]:
        return await ctx.send_help()

    removing = level < 0

    if level == 5:
        newcache = CacheLevel.all()
    elif level == 0:
        newcache = CacheLevel.none()
    elif level in [-3, 3]:
        if removing:
            newcache = current_level - lavalink_cache
        else:
            newcache = current_level + lavalink_cache
    elif level in [-2, 2]:
        if removing:
            newcache = current_level - youtube_cache
        else:
            newcache = current_level + youtube_cache
    elif level in [-1, 1]:
        if removing:
            newcache = current_level - spotify_cache
        else:
            newcache = current_level + spotify_cache
    else:
        return await ctx.send_help()

    has_spotify_cache = newcache.is_superset(spotify_cache)
    has_youtube_cache = newcache.is_superset(youtube_cache)
    has_lavalink_cache = newcache.is_superset(lavalink_cache)
    msg = (
        _("Max age:          [{max_age}]\n")
        + _("Spotify cache:    [{spotify_status}]\n")
        + _("Youtube cache:    [{youtube_status}]\n")
        + _("Lavalink cache:   [{lavalink_status}]\n")
    ).format(
        max_age=str(await self.config.cache_age()) + " " + _("days"),
        spotify_status=_("Enabled") if has_spotify_cache else _("Disabled"),
        youtube_status=_("Enabled") if has_youtube_cache else _("Disabled"),
        lavalink_status=_("Enabled") if has_lavalink_cache else _("Disabled"),
    )

    await self._embed_msg(
        ctx, title=_("Cache Settings"), description=box(msg, lang="ini")
    )

    await self.config.cache_level.set(newcache.value)