Browse Source

Make Message.embeds to be based on discord.Embed

pull/447/head
Rapptz 9 years ago
parent
commit
42891c3084
  1. 9
      discord/message.py

9
discord/message.py

@ -35,6 +35,7 @@ from .object import Object
from .calls import CallMessage from .calls import CallMessage
from .enums import MessageType, try_enum from .enums import MessageType, try_enum
from .errors import InvalidArgument from .errors import InvalidArgument
from .embeds import Embed
class Message: class Message:
"""Represents a message from Discord. """Represents a message from Discord.
@ -58,10 +59,8 @@ class Message:
nonce nonce
The value used by the discord guild and the client to verify that the message is successfully sent. The value used by the discord guild and the client to verify that the message is successfully sent.
This is typically non-important. This is typically non-important.
embeds: list embeds: List[:class:`Embed`]
A list of embedded objects. The elements are objects that meet oEmbed's specification_. A list embeds the message has.
.. _specification: http://oembed.com/
channel channel
The :class:`Channel` that the message was sent from. The :class:`Channel` that the message was sent from.
Could be a :class:`PrivateChannel` if it's a private message. Could be a :class:`PrivateChannel` if it's a private message.
@ -181,7 +180,7 @@ class Message:
self._try_patch(data, 'tts', bool) self._try_patch(data, 'tts', bool)
self._try_patch(data, 'content', str) self._try_patch(data, 'content', str)
self._try_patch(data, 'attachments', lambda x: x) self._try_patch(data, 'attachments', lambda x: x)
self._try_patch(data, 'embeds', lambda x: x) self._try_patch(data, 'embeds', lambda x: list(map(Embed.from_data, x)))
self._try_patch(data, 'nonce', lambda x: x) self._try_patch(data, 'nonce', lambda x: x)
# clear the cached properties # clear the cached properties

Loading…
Cancel
Save