diff options
| author | Rapptz <[email protected]> | 2016-11-13 05:05:22 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-11-13 05:07:58 -0500 |
| commit | af46718460d42cabe9c557719ef72e0df0742b54 (patch) | |
| tree | 68764a275aae61e08d16ebe5a447d82a539dea26 /discord/http.py | |
| parent | Version bump to v0.14.3 (diff) | |
| download | discord.py-af46718460d42cabe9c557719ef72e0df0742b54.tar.xz discord.py-af46718460d42cabe9c557719ef72e0df0742b54.zip | |
Add support for rich embeds.
Diffstat (limited to 'discord/http.py')
| -rw-r--r-- | discord/http.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/http.py b/discord/http.py index d2cf2e4e..6379ade1 100644 --- a/discord/http.py +++ b/discord/http.py @@ -213,16 +213,21 @@ class HTTPClient: return self.post(self.ME + '/channels', json=payload, bucket=_func_()) - def send_message(self, channel_id, content, *, guild_id=None, tts=False): + def send_message(self, channel_id, content, *, guild_id=None, tts=False, embed=None): url = '{0.CHANNELS}/{1}/messages'.format(self, channel_id) payload = { - 'content': str(content), 'nonce': random_integer(-2**63, 2**63 - 1) } + if content: + payload['content'] = content + if tts: payload['tts'] = True + if embed: + payload['embed'] = embed + return self.post(url, json=payload, bucket='messages:' + str(guild_id)) def send_typing(self, channel_id): |