mirror of https://gitlab.com/litecord/litecord.git
schemas: change avatar_url in webhook exec to EmbedURL coerce
- embed.schemas: add EmbedURL.scheme
This commit is contained in:
parent
507393678e
commit
1d9c9f7b85
|
|
@ -31,16 +31,18 @@ class EmbedURL:
|
|||
if parsed.scheme not in ('http', 'https', 'attachment'):
|
||||
raise ValueError('Invalid URL scheme')
|
||||
|
||||
self.scheme = parsed.scheme
|
||||
self.raw_url = url
|
||||
self.parsed = parsed
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""Return the URL."""
|
||||
def url(self) -> str:
|
||||
"""Return the unparsed URL."""
|
||||
return urllib.parse.urlunparse(self.parsed)
|
||||
|
||||
@property
|
||||
def to_json(self):
|
||||
def to_json(self) -> str:
|
||||
"""'json' version of the url."""
|
||||
return self.url
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from .enums import (
|
|||
MessageNotifications, ChannelType, VerificationLevel
|
||||
)
|
||||
|
||||
from litecord.embed.schemas import EMBED_OBJECT
|
||||
from litecord.embed.schemas import EMBED_OBJECT, EmbedURL
|
||||
|
||||
log = Logger(__name__)
|
||||
|
||||
|
|
@ -710,10 +710,8 @@ WEBHOOK_MESSAGE_CREATE = {
|
|||
'minlength': 2, 'maxlength': 32, 'required': False
|
||||
},
|
||||
|
||||
# TODO: url type, or something...
|
||||
'avatar_url': {
|
||||
# 'type': 'url', 'required': False
|
||||
'type': 'string', 'required': False
|
||||
'coerce': EmbedURL, 'required': False
|
||||
},
|
||||
|
||||
'embeds': {
|
||||
|
|
|
|||
Loading…
Reference in New Issue