diff options
| author | Rapptz <[email protected]> | 2016-12-23 23:38:30 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:52:01 -0500 |
| commit | a1c81419b792b07e6e395d8ab3039998109c126d (patch) | |
| tree | 729bf8bd7d1e855bcd68962952fddf374544ae9c /discord/http.py | |
| parent | Remove no longer used functions in Client. (diff) | |
| download | discord.py-a1c81419b792b07e6e395d8ab3039998109c126d.tar.xz discord.py-a1c81419b792b07e6e395d8ab3039998109c126d.zip | |
Rename MessageChannel.send_message to send and unify interface.
This removes MessageChannel.upload.
Diffstat (limited to 'discord/http.py')
| -rw-r--r-- | discord/http.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/discord/http.py b/discord/http.py index ecb9cd9f..2a9798ac 100644 --- a/discord/http.py +++ b/discord/http.py @@ -234,14 +234,17 @@ class HTTPClient: url = '{0.CHANNELS}/{1}/typing'.format(self, channel_id) return self.post(url, bucket=_func_()) - def send_file(self, channel_id, buffer, *, guild_id=None, filename=None, content=None, tts=False): + def send_file(self, channel_id, buffer, *, guild_id=None, filename=None, content=None, tts=False, embed=None): url = '{0.CHANNELS}/{1}/messages'.format(self, channel_id) form = aiohttp.FormData() - if content is not None: - form.add_field('content', str(content)) + payload = {'tts': tts} + if content: + payload['content'] = content + if embed: + payload['embed'] = embed - form.add_field('tts', 'true' if tts else 'false') + form.add_field('payload_json', utils.to_json(payload)) form.add_field('file', buffer, filename=filename, content_type='application/octet-stream') return self.post(url, data=form, bucket='messages:' + str(guild_id)) |