From af9e5bc67a189096663a694cd99484e14877d1d7 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 26 Nov 2015 19:30:09 -0500 Subject: [PATCH] Simplify examples to no longer use logging or Client.is_logged_in The logging module is no longer required to get diagnostic output since we use `stderr` by default regardless of the logging module. Which means that the logging module will only give a more verbose output than is necessary. Client.is_logged_in checking is no longer necessary since all HTTP request handling now raise an exception if they fail so those chunks are also gone. --- examples/deleted.py | 8 -------- examples/echo.py | 8 -------- examples/edits.py | 8 -------- examples/reply.py | 8 -------- 4 files changed, 32 deletions(-) diff --git a/examples/deleted.py b/examples/deleted.py index 3bd38ec31..7f77e9c38 100644 --- a/examples/deleted.py +++ b/examples/deleted.py @@ -1,16 +1,8 @@ import discord -import logging - -# Set up the logging module to output diagnostic to the console. -logging.basicConfig() 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!') diff --git a/examples/echo.py b/examples/echo.py index 219085330..ce5eef901 100644 --- a/examples/echo.py +++ b/examples/echo.py @@ -1,16 +1,8 @@ import discord -import logging - -# Set up the logging module to output diagnostic to the console. -logging.basicConfig() 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!') diff --git a/examples/edits.py b/examples/edits.py index 3bf375dcd..e8233bbb0 100644 --- a/examples/edits.py +++ b/examples/edits.py @@ -1,17 +1,9 @@ import discord import time -import logging - -# Set up the logging module to output diagnostic to the console. -logging.basicConfig() 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!') diff --git a/examples/reply.py b/examples/reply.py index e23db9622..f3f56c72c 100644 --- a/examples/reply.py +++ b/examples/reply.py @@ -1,16 +1,8 @@ import discord -import logging - -# Set up the logging module to output diagnostic to the console. -logging.basicConfig() 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'):