Add support for rich embeds.

This commit is contained in:
Rapptz
2016-11-13 05:05:22 -05:00
parent a7ba0bb7c4
commit af46718460
5 changed files with 446 additions and 6 deletions

View File

@ -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):