Embed fixes

This commit is contained in:
gabixdev 2019-03-01 21:08:58 +01:00
parent 66efd78018
commit a7dc9e01dc
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
3 changed files with 13 additions and 6 deletions

View File

@ -407,6 +407,9 @@ async def _create_message(channel_id):
await _dm_pre_dispatch(channel_id, user_id)
await _dm_pre_dispatch(channel_id, guild_id)
if payload['webhook_id'] == None:
payload.pop('webhook_id', None)
await app.dispatcher.dispatch('channel', channel_id,
'MESSAGE_CREATE', payload)

View File

@ -46,7 +46,7 @@ class EmbedURL:
EMBED_FOOTER = {
'text': {
'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': True},
'type': 'string', 'minlength': 1, 'maxlength': 1024, 'required': True},
'icon_url': {
'coerce': EmbedURL, 'required': False,
@ -65,7 +65,7 @@ EMBED_THUMBNAIL = EMBED_IMAGE
EMBED_AUTHOR = {
'name': {
'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': False
'type': 'string', 'minlength': 1, 'maxlength': 256, 'required': False
},
'url': {
'coerce': EmbedURL, 'required': False,
@ -79,10 +79,10 @@ EMBED_AUTHOR = {
EMBED_FIELD = {
'name': {
'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': True
'type': 'string', 'minlength': 1, 'maxlength': 256, 'required': True
},
'value': {
'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': True
'type': 'string', 'minlength': 1, 'maxlength': 1024, 'required': True
},
'inline': {
'type': 'boolean', 'required': False, 'default': True,
@ -91,10 +91,10 @@ EMBED_FIELD = {
EMBED_OBJECT = {
'title': {
'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': False},
'type': 'string', 'minlength': 1, 'maxlength': 256, 'required': False},
# NOTE: type set by us
'description': {
'type': 'string', 'minlength': 1, 'maxlength': 1024, 'required': False,
'type': 'string', 'minlength': 1, 'maxlength': 2048, 'required': False,
},
'url': {
'coerce': EmbedURL, 'required': False,

View File

@ -37,6 +37,10 @@ class Color:
"""Give the actual RGB integer encoding this color."""
return int('%02x%02x%02x' % (self.red, self.green, self.blue), 16)
@property
def to_json(self):
return self.value
def __int__(self):
return self.value