mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-08 12:48:39 +00:00
Fix typing of various AppCommand decorators
This commit is contained in:
parent
0bb6967419
commit
a1206dfde8
@ -2523,6 +2523,16 @@ def guild_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
|||||||
return inner(func)
|
return inner(func)
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def private_channel_only(func: None = ...) -> Callable[[T], T]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def private_channel_only(func: T) -> T:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def private_channel_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
def private_channel_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
||||||
"""A decorator that indicates this command can only be used in the context of DMs and group DMs.
|
"""A decorator that indicates this command can only be used in the context of DMs and group DMs.
|
||||||
|
|
||||||
@ -2565,6 +2575,16 @@ def private_channel_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]
|
|||||||
return inner(func)
|
return inner(func)
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def dm_only(func: None = ...) -> Callable[[T], T]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def dm_only(func: T) -> T:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def dm_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
def dm_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
||||||
"""A decorator that indicates this command can only be used in the context of bot DMs.
|
"""A decorator that indicates this command can only be used in the context of bot DMs.
|
||||||
|
|
||||||
@ -2606,9 +2626,7 @@ def dm_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
|||||||
return inner(func)
|
return inner(func)
|
||||||
|
|
||||||
|
|
||||||
def allowed_contexts(
|
def allowed_contexts(guilds: bool = MISSING, dms: bool = MISSING, private_channels: bool = MISSING) -> Callable[[T], T]:
|
||||||
guilds: bool = MISSING, dms: bool = MISSING, private_channels: bool = MISSING
|
|
||||||
) -> Union[T, Callable[[T], T]]:
|
|
||||||
"""A decorator that indicates this command can only be used in certain contexts.
|
"""A decorator that indicates this command can only be used in certain contexts.
|
||||||
Valid contexts are guilds, DMs and private channels.
|
Valid contexts are guilds, DMs and private channels.
|
||||||
|
|
||||||
@ -2650,6 +2668,16 @@ def allowed_contexts(
|
|||||||
return inner
|
return inner
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def guild_install(func: None = ...) -> Callable[[T], T]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def guild_install(func: T) -> T:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def guild_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
def guild_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
||||||
"""A decorator that indicates this command should be installed in guilds.
|
"""A decorator that indicates this command should be installed in guilds.
|
||||||
|
|
||||||
@ -2688,6 +2716,16 @@ def guild_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
|||||||
return inner(func)
|
return inner(func)
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def user_install(func: None = ...) -> Callable[[T], T]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def user_install(func: T) -> T:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def user_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
def user_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
||||||
"""A decorator that indicates this command should be installed for users.
|
"""A decorator that indicates this command should be installed for users.
|
||||||
|
|
||||||
@ -2729,7 +2767,7 @@ def user_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
|
|||||||
def allowed_installs(
|
def allowed_installs(
|
||||||
guilds: bool = MISSING,
|
guilds: bool = MISSING,
|
||||||
users: bool = MISSING,
|
users: bool = MISSING,
|
||||||
) -> Union[T, Callable[[T], T]]:
|
) -> Callable[[T], T]:
|
||||||
"""A decorator that indicates this command should be installed in certain contexts.
|
"""A decorator that indicates this command should be installed in certain contexts.
|
||||||
Valid contexts are guilds and users.
|
Valid contexts are guilds and users.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user