mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
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.
This commit is contained in:
parent
68c3fde089
commit
a98324fbf8
@ -3,6 +3,10 @@ import discord
|
||||
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!')
|
||||
|
@ -3,6 +3,10 @@ import discord
|
||||
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!')
|
||||
|
@ -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!')
|
||||
|
@ -3,6 +3,10 @@ import discord
|
||||
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_message(message):
|
||||
if message.content.startswith('!hello'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user