From 1e1f1114386636dfa12ae1121df1882c72aa23cd Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 19 Sep 2018 18:20:56 +0200 Subject: [PATCH] Weird discordpy behaviour --- bots.py | 1 - discordbot.py | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bots.py b/bots.py index e878ebab..3c746f14 100644 --- a/bots.py +++ b/bots.py @@ -8,7 +8,6 @@ import logging import coloredlogs import os - logging.getLogger().disabled = True logger = logging.getLogger(__name__) os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s" diff --git a/discordbot.py b/discordbot.py index e5a9b893..bac1460f 100644 --- a/discordbot.py +++ b/discordbot.py @@ -414,10 +414,13 @@ class RoyalDiscordBot(discord.Client): if member.activity.type == discord.ActivityType.playing: message += f" | 🎮 {member.activity.name}" # Rich presence - if member.activity.state: + try: message += f" ({member.activity.state})" - elif member.activity.details: - message += f" ({member.activity.details})" + except AttributeError: + try: + message += f" ({member.activity.details})" + except AttributeError: + pass elif member.activity.type == discord.ActivityType.streaming: message += f" | 📡 [{member.activity.name}]({member.activity.url})" elif member.activity.type == discord.ActivityType.listening: