aboutsummaryrefslogtreecommitdiff
path: root/discord/webhook
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2021-04-29 06:58:36 +0100
committerGitHub <[email protected]>2021-04-29 01:58:36 -0400
commitc786a85a9b726c7f24574a89f24b16a15ab2fe47 (patch)
tree5b1d985f366767d5cbbc25ba6526721b584f5745 /discord/webhook
parent[commands] Update error message for Literal float/complex (diff)
downloaddiscord.py-c786a85a9b726c7f24574a89f24b16a15ab2fe47.tar.xz
discord.py-c786a85a9b726c7f24574a89f24b16a15ab2fe47.zip
Add utils.MISSING
Diffstat (limited to 'discord/webhook')
-rw-r--r--discord/webhook/async_.py13
-rw-r--r--discord/webhook/sync.py5
2 files changed, 6 insertions, 12 deletions
diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py
index 32552455..2a42b52b 100644
--- a/discord/webhook/async_.py
+++ b/discord/webhook/async_.py
@@ -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.
diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py
index 98bb528e..23445317 100644
--- a/discord/webhook/sync.py
+++ b/discord/webhook/sync.py
@@ -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()