Skip to content

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

@njhargis

Description

@njhargis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions