aboutsummaryrefslogtreecommitdiff
path: root/examples/edits.py
diff options
context:
space:
mode:
authorHornwitser <[email protected]>2015-09-30 19:58:19 +0200
committerHornwitser <[email protected]>2015-10-06 19:09:16 +0200
commita98324fbf84a5ad1bce5ab9c8385e9fe4574dcfe (patch)
tree4a5ba78324f9fdfb02ca9cb7b0b97caca7e8a7ff /examples/edits.py
parentMake event based handlers first class (diff)
downloaddiscord.py-a98324fbf84a5ad1bce5ab9c8385e9fe4574dcfe.tar.xz
discord.py-a98324fbf84a5ad1bce5ab9c8385e9fe4574dcfe.zip
Add handling of login failure in examples
Check and handle login failure in the examples provided for using this library. This is a common error condition that should be handled by any script using this library.
Diffstat (limited to 'examples/edits.py')
-rw-r--r--examples/edits.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/edits.py b/examples/edits.py
index e8233bbb..cb07dc6b 100644
--- a/examples/edits.py
+++ b/examples/edits.py
@@ -4,6 +4,10 @@ import time
client = discord.Client()
client.login('email', 'password')
+if not client.is_logged_in:
+ print('Logging in to Discord failed')
+ exit(1)
+
@client.event
def on_ready():
print('Connected!')