Move MissingApplicationID to top-level discord namespace

This commit is contained in:
Rapptz
2024-08-31 08:51:56 -04:00
parent 66d74054dd
commit df4b1c88df
8 changed files with 39 additions and 26 deletions

View File

@@ -27,7 +27,7 @@ from __future__ import annotations
from typing import Any, TYPE_CHECKING, List, Optional, Sequence, Union
from ..enums import AppCommandOptionType, AppCommandType, Locale
from ..errors import DiscordException, HTTPException, _flatten_error_dict
from ..errors import DiscordException, HTTPException, _flatten_error_dict, MissingApplicationID as MissingApplicationID
from ..utils import _human_join
__all__ = (
@@ -59,11 +59,6 @@ if TYPE_CHECKING:
CommandTypes = Union[Command[Any, ..., Any], Group, ContextMenu]
APP_ID_NOT_FOUND = (
'Client does not have an application_id set. Either the function was called before on_ready '
'was called or application_id was not passed to the Client constructor.'
)
class AppCommandError(DiscordException):
"""The base exception type for all application command related errors.
@@ -422,19 +417,6 @@ class CommandSignatureMismatch(AppCommandError):
super().__init__(msg)
class MissingApplicationID(AppCommandError):
"""An exception raised when the client does not have an application ID set.
An application ID is required for syncing application commands.
This inherits from :exc:`~discord.app_commands.AppCommandError`.
.. versionadded:: 2.0
"""
def __init__(self, message: Optional[str] = None):
super().__init__(message or APP_ID_NOT_FOUND)
def _get_command_error(
index: str,
inner: Any,