mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 08:56:19 +00:00
Remove discord.InvalidArgument
This uses TypeError and ValueError instead.
This commit is contained in:
@ -28,7 +28,6 @@ import datetime
|
||||
from typing import Any, Dict, Optional, TYPE_CHECKING, overload, Type, Tuple
|
||||
from .utils import _get_as_snowflake, parse_time, MISSING
|
||||
from .user import User
|
||||
from .errors import InvalidArgument
|
||||
from .enums import try_enum, ExpireBehaviour
|
||||
|
||||
__all__ = (
|
||||
@ -232,6 +231,10 @@ class StreamIntegration(Integration):
|
||||
You must have the :attr:`~Permissions.manage_guild` permission to
|
||||
do this.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
This function no-longer raises ``InvalidArgument`` instead raising
|
||||
:exc:`TypeError`.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
expire_behaviour: :class:`ExpireBehaviour`
|
||||
@ -247,13 +250,13 @@ class StreamIntegration(Integration):
|
||||
You do not have permission to edit the integration.
|
||||
HTTPException
|
||||
Editing the guild failed.
|
||||
InvalidArgument
|
||||
TypeError
|
||||
``expire_behaviour`` did not receive a :class:`ExpireBehaviour`.
|
||||
"""
|
||||
payload: Dict[str, Any] = {}
|
||||
if expire_behaviour is not MISSING:
|
||||
if not isinstance(expire_behaviour, ExpireBehaviour):
|
||||
raise InvalidArgument('expire_behaviour field must be of type ExpireBehaviour')
|
||||
raise TypeError('expire_behaviour field must be of type ExpireBehaviour')
|
||||
|
||||
payload['expire_behavior'] = expire_behaviour.value
|
||||
|
||||
|
Reference in New Issue
Block a user