diff options
| author | Rapptz <[email protected]> | 2016-11-13 22:12:16 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-11-13 22:12:16 -0500 |
| commit | a312f21bc32aaff154944f99075c83a1473c0bd4 (patch) | |
| tree | 27e2c046b8fedc36aaea71a58668013231f873c1 /discord/client.py | |
| parent | Add support for rich embeds. (diff) | |
| download | discord.py-a312f21bc32aaff154944f99075c83a1473c0bd4.tar.xz discord.py-a312f21bc32aaff154944f99075c83a1473c0bd4.zip | |
Support message editing with rich embeds.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py index f7d223bb..7b836f30 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1374,13 +1374,16 @@ class Client: ret.append(msg) @asyncio.coroutine - def edit_message(self, message, new_content): + def edit_message(self, message, new_content=None, *, embed=None): """|coro| Edits a :class:`Message` with the new message content. The new_content must be able to be transformed into a string via ``str(new_content)``. + If the ``new_content`` is not provided, then ``embed`` must be provided, which must + be of type :class:`Embed`. + The :class:`Message` object is not directly modified afterwards until the corresponding WebSocket event is received. @@ -1403,9 +1406,10 @@ class Client: """ channel = message.channel - content = str(new_content) + content = str(new_content) if new_content else None + embed = embed.to_dict() if embed else None guild_id = channel.server.id if not getattr(channel, 'is_private', True) else None - data = yield from self.http.edit_message(message.id, channel.id, content, guild_id=guild_id) + data = yield from self.http.edit_message(message.id, channel.id, content, guild_id=guild_id, embed=embed) return self.connection._create_message(channel=channel, **data) @asyncio.coroutine |