mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 11:48:55 -05:00
Add clearer error when pages isn't made of embeds nor strings in menu() (#3571)
* Update menus.py * Update menus.py
This commit is contained in:
parent
54b712fa71
commit
5ee73cdf63
@ -6,7 +6,7 @@ import asyncio
|
|||||||
import contextlib
|
import contextlib
|
||||||
import functools
|
import functools
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Union, Iterable, Optional
|
from typing import Iterable, List, Optional, Union
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from .. import commands
|
from .. import commands
|
||||||
@ -17,7 +17,7 @@ _ReactableEmoji = Union[str, discord.Emoji]
|
|||||||
|
|
||||||
async def menu(
|
async def menu(
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
pages: list,
|
pages: Union[List[str], List[discord.Embed]],
|
||||||
controls: dict,
|
controls: dict,
|
||||||
message: discord.Message = None,
|
message: discord.Message = None,
|
||||||
page: int = 0,
|
page: int = 0,
|
||||||
@ -57,6 +57,8 @@ async def menu(
|
|||||||
RuntimeError
|
RuntimeError
|
||||||
If either of the notes above are violated
|
If either of the notes above are violated
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(pages[0], (discord.Embed, str)):
|
||||||
|
raise RuntimeError("Pages must be of type discord.Embed or str")
|
||||||
if not all(isinstance(x, discord.Embed) for x in pages) and not all(
|
if not all(isinstance(x, discord.Embed) for x in pages) and not all(
|
||||||
isinstance(x, str) for x in pages
|
isinstance(x, str) for x in pages
|
||||||
):
|
):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user