Nadir Chowdhury
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
20 additions and
24 deletions
-
discord/abc.py
-
discord/ext/commands/flags.py
-
discord/utils.py
-
discord/webhook/async_.py
-
discord/webhook/sync.py
|
|
@ -24,14 +24,13 @@ DEALINGS IN THE SOFTWARE. |
|
|
|
|
|
|
|
from __future__ import annotations |
|
|
|
|
|
|
|
import sys |
|
|
|
import copy |
|
|
|
import asyncio |
|
|
|
from typing import TYPE_CHECKING, Protocol, runtime_checkable |
|
|
|
|
|
|
|
from .iterators import HistoryIterator |
|
|
|
from .context_managers import Typing |
|
|
|
from .enums import ChannelType, VideoQualityMode |
|
|
|
from .enums import ChannelType |
|
|
|
from .errors import InvalidArgument, ClientException |
|
|
|
from .mentions import AllowedMentions |
|
|
|
from .permissions import PermissionOverwrite, Permissions |
|
|
@ -692,7 +691,7 @@ class GuildChannel(Protocol): |
|
|
|
else: |
|
|
|
raise InvalidArgument('target parameter must be either Member or Role') |
|
|
|
|
|
|
|
if isinstance(overwrite, _Undefined): |
|
|
|
if overwrite is _undefined: |
|
|
|
if len(permissions) == 0: |
|
|
|
raise InvalidArgument('No overwrite provided.') |
|
|
|
try: |
|
|
|
|
|
@ -36,7 +36,7 @@ from discord.utils import resolve_annotation |
|
|
|
from .view import StringView |
|
|
|
from .converter import run_converters |
|
|
|
|
|
|
|
from discord.utils import maybe_coroutine |
|
|
|
from discord.utils import maybe_coroutine, MISSING |
|
|
|
from dataclasses import dataclass, field |
|
|
|
from typing import ( |
|
|
|
Dict, |
|
|
@ -69,14 +69,6 @@ if TYPE_CHECKING: |
|
|
|
from .context import Context |
|
|
|
|
|
|
|
|
|
|
|
class _MissingSentinel: |
|
|
|
def __repr__(self): |
|
|
|
return 'MISSING' |
|
|
|
|
|
|
|
|
|
|
|
MISSING: Any = _MissingSentinel() |
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
class Flag: |
|
|
|
"""Represents a flag parameter for :class:`FlagConverter`. |
|
|
|
|
|
@ -79,6 +79,17 @@ __all__ = ( |
|
|
|
DISCORD_EPOCH = 1420070400000 |
|
|
|
|
|
|
|
|
|
|
|
class _MissingSentinel: |
|
|
|
def __eq__(self, other): |
|
|
|
return False |
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
return '...' |
|
|
|
|
|
|
|
|
|
|
|
MISSING: Any = _MissingSentinel() |
|
|
|
|
|
|
|
|
|
|
|
class _cached_property: |
|
|
|
def __init__(self, function): |
|
|
|
self.function = function |
|
|
|
|
|
@ -28,7 +28,6 @@ import contextvars |
|
|
|
import logging |
|
|
|
import asyncio |
|
|
|
import json |
|
|
|
import time |
|
|
|
import re |
|
|
|
|
|
|
|
from urllib.parse import quote as urlquote |
|
|
@ -67,16 +66,7 @@ if TYPE_CHECKING: |
|
|
|
from ..abc import Snowflake |
|
|
|
import datetime |
|
|
|
|
|
|
|
|
|
|
|
class _Missing: |
|
|
|
def __bool__(self): |
|
|
|
return False |
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
return '...' |
|
|
|
|
|
|
|
|
|
|
|
MISSING: Any = _Missing() |
|
|
|
MISSING = utils.MISSING |
|
|
|
|
|
|
|
|
|
|
|
class AsyncDeferredLock: |
|
|
@ -731,6 +721,7 @@ class BaseWebhook(Hashable): |
|
|
|
return Asset._from_default_avatar(self._state, 0) |
|
|
|
return Asset._from_avatar(self._state, self.id, self._avatar) |
|
|
|
|
|
|
|
|
|
|
|
class Webhook(BaseWebhook): |
|
|
|
"""Represents an asynchronous Discord webhook. |
|
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ from ..message import Message |
|
|
|
from ..http import Route |
|
|
|
from ..object import Object |
|
|
|
|
|
|
|
from .async_ import BaseWebhook, handle_message_parameters, _WebhookState, MISSING |
|
|
|
from .async_ import BaseWebhook, handle_message_parameters, _WebhookState |
|
|
|
|
|
|
|
__all__ = ( |
|
|
|
'SyncWebhook', |
|
|
@ -68,6 +68,8 @@ if TYPE_CHECKING: |
|
|
|
except ModuleNotFoundError: |
|
|
|
pass |
|
|
|
|
|
|
|
MISSING = utils.MISSING |
|
|
|
|
|
|
|
|
|
|
|
class DeferredLock: |
|
|
|
def __init__(self, lock: threading.Lock): |
|
|
@ -333,6 +335,7 @@ class WebhookAdapter: |
|
|
|
route = Route('GET', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token) |
|
|
|
return self.request(route, session=session) |
|
|
|
|
|
|
|
|
|
|
|
_context = threading.local() |
|
|
|
_context.adapter = WebhookAdapter() |
|
|
|
|
|
|
|