Closed laggron42 closed 4 years ago
I can reproduce this on commit https://github.com/Cog-Creators/Red-DiscordBot/commit/b3363acf77e834a46e2948ea24feb38603a61ee2.
a.customcom create laggron betterlaggron
a.eval from redbot.core import Config
c = Config.get_conf(None, 414589031223512, cog_name="CustomCommands")
return await c.guild(guild).commands()
Ignoring exception in on_message
Traceback (most recent call last):
File "/data/venv/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "/data/venv/lib/python3.7/site-packages/redbot/cogs/customcom/customcom.py", line 459, in on_message
message=message, command=ctx.invoked_with
File "/data/venv/lib/python3.7/site-packages/redbot/cogs/customcom/customcom.py", line 89, in get
ccinfo = await self.db(message.guild).commands.get_raw(command, default=None)
AttributeError: 'Value' object has no attribute 'get_raw'
Indeed I tested Laggron issue and I got exactly the same error. For context I am on same commit as @Stonedestroyer.
Other bugs
There is an issue when calling
Config.get_conf
two times for the same instance (from another cog or an eval). Both config instances will conflict, as I see, one isn't aware of what the other do, which means that if we do something with our second instance, the first one will be corrupted (didn't manage to recover my data after a restart).What were you trying to do?
Edit a Config instance of a loaded cog with an eval command:
What were you expecting to happen?
Read/write the value.
What actually happened?
The read/write is successful, but the cog's config instance will be corrupted, giving errors for pretty much anything related to config. Those errors are the most common:
Note: the key is the Red server's ID, trying to access
conf.guild(ctx.guild)
which was never called before (no data for that guild)Trying to get a random value
That one is probably the most common: attribute error on "Value" object
I got that one after calling
conf.clear_all()
with eval, then tried some commandsThose errors occurs with future evals or the cog itself.
Most of those are from my WarnSystem cog. However, I tried with the core custom commands cog (see the steps I did below).
How can we reproduce this issue?
For breaking the core custom commands cog (tested on the dev build):
Create a custom command and test it (did it on a fresh instance)
Eval the following code:
Output on my side:
Try to invoke the custom command again, and see: