mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[Utils] Allow functools.partial use with menu (#2720)
This commit is contained in:
parent
1cfce8b72c
commit
0a832cee9c
@ -4,6 +4,7 @@
|
||||
# Ported to Red V3 by Palm\_\_ (https://github.com/palmtree5)
|
||||
import asyncio
|
||||
import contextlib
|
||||
import functools
|
||||
from typing import Union, Iterable, Optional
|
||||
import discord
|
||||
|
||||
@ -60,7 +61,10 @@ async def menu(
|
||||
):
|
||||
raise RuntimeError("All pages must be of the same type")
|
||||
for key, value in controls.items():
|
||||
if not asyncio.iscoroutinefunction(value):
|
||||
maybe_coro = value
|
||||
if isinstance(value, functools.partial):
|
||||
maybe_coro = value.func
|
||||
if not asyncio.iscoroutinefunction(maybe_coro):
|
||||
raise RuntimeError("Function must be a coroutine")
|
||||
current_page = pages[page]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user