robertwayne / dpymenus

Simplified menus for discord.py developers.
https://dpymenus.com/
MIT License
26 stars 4 forks source link

[Critical] - Cannot use the menu when it's in use in another server. #9

Closed pTinosq closed 4 years ago

pTinosq commented 4 years ago

This is a really big deal, especially when you have a bot in hundreds of servers!

The error:

Ignoring exception in command menu:
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 83, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\user\Desktop\Desktop Stuff\programming\PY\Discord\ColourbotBETA\cogs\Information.py", line 109, in menu
    await menu3.add_pages([colourPage, premiumPage, botPage, serverPage])
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\dpymenus\paginated_menu.py", line 67, in add_pages
    self.pages.append(Page(embed=embed))
AttributeError: 'PaginatedMenu' object has no attribute 'pages'

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

Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 892, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 797, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 92, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'PaginatedMenu' object has no attribute 'pages'

Replication: Use the new paginatedmenu feature like so:

await menu3.add_pages([e1, e2, e3, e4])

await menu3.open()

Navigate to server #1 and run -menu (Or whatever command you're using for testing)

Navigate to server #2 and run the same command and you should get an error.

Error active v0.3.0

robertwayne commented 4 years ago

I'll take a deeper look into this later today. It's pretty odd that this is an issue. The only thing that should happen cross-server is blocking a single user from invoking a menu of they have one open already (which I realize needs to be addressed as well, though I need to factor in anti-abuse).

robertwayne commented 4 years ago

Should be fixed by 59d48e16b54cc66642c07e6df6318d331fe4b817, 5a61b94ac501e8195c7cf054f4827e8e56539389, 9b5ace42e5a787697e4743d1c49410ae7ba7ff8b.