Redjumpman / Jumper-Plugins

Python Modules for Discord bot
GNU General Public License v3.0
131 stars 95 forks source link

[Shop] More than 5 shops breaks the !shop buy command menu #259

Open njhargis opened 2 years ago

njhargis commented 2 years ago

I have added 5 shops and !shop buy works great, upon adding the sixth shop my buy command begins to break. Log below.

Exception in command 'shop buy' Traceback (most recent call last): File "/home/neil/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/shop.py", line 185, in buy shop, item = await menu.display() File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/menu.py", line 19, in display msg, groups, page, maximum = await self.setup(data) File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/menu.py", line 42, in setup groups = self.group_data(data) File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/menu.py", line 162, in group_data grouped.append(self.sorter(data[idx : idx + 5])) File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/menu.py", line 154, in sorter return sorted(groups, key=lambda x: x[1]["Cost"], reverse=True) File "/home/neil/.local/share/Red-DiscordBot/data/Steamboat_Bill/cogs/CogManager/cogs/shop/menu.py", line 154, in return sorted(groups, key=lambda x: x[1]["Cost"], reverse=True) TypeError: string indices must be integers

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

Traceback (most recent call last): File "/home/neil/redenv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/home/neil/redenv/lib/python3.9/site-packages/redbot/core/commands/commands.py", line 832, in invoke await super().invoke(ctx) File "/home/neil/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1348, in invoke await ctx.invoked_subcommand.invoke(ctx) File "/home/neil/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke [9:29 AM] BOT Steamboat Bill: await injected(*ctx.args, **ctx.kwargs) File "/home/neil/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers

njhargis commented 2 years ago

Looks like this has been an issue since 2019. https://discord.com/channels/240154543684321280/240302038565519361/623588710449152022