aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-08-21 20:39:22 -0400
committerRapptz <[email protected]>2015-08-21 20:56:03 -0400
commit35935b373b70bfc5ec5fc1182256339c149fc51b (patch)
treea46849b2fc54603caecbd12d16b7b20eff0563a5
parentFix heartbeat interval bug. (diff)
downloaddiscord.py-35935b373b70bfc5ec5fc1182256339c149fc51b.tar.xz
discord.py-35935b373b70bfc5ec5fc1182256339c149fc51b.zip
Return the message created when calling send_message
-rw-r--r--.gitignore1
-rw-r--r--discord/client.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e2103c24..25831f35 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.json
*.pyc
docs/_build
+*.buildinfo
diff --git a/discord/client.py b/discord/client.py
index 507bd7bc..bd74ac29 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -221,6 +221,7 @@ class Client(object):
:param destination: The location to send the message.
:param content: The content of the message to send.
:param mentions: A list of :class:`User` to mention in the message or a boolean. Ignored for private messages.
+ :return: The :class:`Message` sent or None if error occurred.
"""
channel_id = ''
@@ -257,6 +258,11 @@ class Client(object):
payload['mentions'] = mentions
response = requests.post(url, json=payload, headers=self.headers)
+ if response.status_code == 200:
+ data = response.json()
+ channel = self.get_channel(data.get('channel_id'))
+ message = Message(channel=channel, **response.json())
+ return message
def login(self, email, password):