Repository: Cog-Creators/Red-DiscordBot

Issue:
[V3] CLI prefix display


### Type:

- [ ] Suggestion
- [X] Bug

### Brief description of the problem
When using the `--prefix` flag, the bot's loaded message still displays the prefix(es) it had stored prior (in some cases, this could be none)
### Expected behavior
The new prefix(es) should be displayed
### Actual behavior
New prefix is usable, but not reflected in the CLI
### Steps to reproduce

1. launch the bot using the prefix flag and observe


[v3] - Invalid version number.
# Other bugs

<!-- 
Did you find a bug with something other than a command? Fill out the following:
-->

#### What were you trying to do?
Load the bot

#### What were you expecting to happen?

Bot stays quiet, or shows a splash

#### What actually happened?

```[29/05/2018 20:59] ERROR events on_error 181: Exception in on_ready
Traceback (most recent call last):
  File "/root/.pyenv/versions/3.6.5/lib/python3.6/site-packages/discord/client.py", line 224, in _run_event
    yield from coro(*args, **kwargs)
  File "/root/.pyenv/versions/3.6.5/lib/python3.6/site-packages/redbot/core/events.py", line 125, in on_ready
    if StrictVersion(data["info"]["version"]) > StrictVersion(red_version):
  File "/root/.pyenv/versions/3.6.5/lib/python3.6/distutils/version.py", line 40, in __init__
    self.parse(vstring)
  File "/root/.pyenv/versions/3.6.5/lib/python3.6/distutils/version.py", line 137, in parse
    raise ValueError("invalid version number '%s'" % vstring)
ValueError: invalid version number '3.0.0b15.post2'
```

#### How can we reproduce this issue?

Unsure. I just loaded the bot on a fresh and clean server.



Discussion:
Can confirm this applies to all CLI args that overwrite behavior of things in tmp_data in cli.py now, have not been working on a fix yet though
We apologise for this issue, and we are working to solve it, however for now the best workaround would be to downgrade back to beta 15 with `pip install --force-reinstall red-discordbot==3.0.0b15`. **However**, please note that installing this version requires a C compiler to be installed on your system. 

If you would rather not have to install a C compiler, you can install beta 15 without fuzzy command search with `pip install -U --force-reinstall --no-cache-dir https://github.com/mikeshardmind/Red-DiscordBot/archive/no-fuzz.zip#egg=red-discordbot`.
Note that none of the above options (b15post2, downgrading to b15, or using the non-supported branch without fuzzysearch) will work using the launcher. The launcher attempts a version comparison to see if an update is available, and will continue not working until b16 hits pypi

Resolving patch:
diff --git a/redbot/core/events.py b/redbot/core/events.py
--- a/redbot/core/events.py
+++ b/redbot/core/events.py
@@ -96,7 +96,7 @@ async def on_ready():
             else:
                 invite_url = None
 
-        prefixes = await bot.db.prefix()
+        prefixes = cli_flags.prefix or (await bot.db.prefix())
         lang = await bot.db.locale()
         red_version = __version__
         red_pkg = pkg_resources.get_distribution("Red-DiscordBot")
@@ -118,24 +118,24 @@ async def on_ready():
 
         INFO.append("{} cogs with {} commands".format(len(bot.cogs), len(bot.commands)))
 
-        async with aiohttp.ClientSession() as session:
-            async with session.get("https://pypi.python.org/pypi/red-discordbot/json") as r:
-                data = await r.json()
-        if StrictVersion(data["info"]["version"]) > StrictVersion(red_version):
-            INFO.append(
-                "Outdated version! {} is available "
-                "but you're using {}".format(data["info"]["version"], red_version)
-            )
-            owner = discord.utils.get(bot.get_all_members(), id=bot.owner_id)
-            try:
+        try:
+            async with aiohttp.ClientSession() as session:
+                async with session.get("https://pypi.python.org/pypi/red-discordbot/json") as r:
+                    data = await r.json()
+            if StrictVersion(data["info"]["version"]) > StrictVersion(red_version):
+                INFO.append(
+                    "Outdated version! {} is available "
+                    "but you're using {}".format(data["info"]["version"], red_version)
+                )
+                owner = discord.utils.get(bot.get_all_members(), id=bot.owner_id)
                 await owner.send(
                     "Your Red instance is out of date! {} is the current "
                     "version, however you are using {}!".format(
                         data["info"]["version"], red_version
                     )
                 )
-            except:
-                pass
+        except:
+            pass
         INFO2 = []
 
         sentry = await bot.db.enable_sentry()


Test patch: