From d20724d7b20ed010a03867398a09fc3ab46a03eb Mon Sep 17 00:00:00 2001 From: Sebass13 Date: Tue, 20 Feb 2018 17:06:06 -0600 Subject: [PATCH] [V3 General] Fix error in [p]userinfo when game is not set (#1325) * Fix #1321 Modifies the game-checking lines so that they don't assume `user.game` is not a NoneType object. * Fix #1321 Modifies the game-checking lines so that they don't assume user.game is not a NoneType object. Also alerts the user to go bother @tekulvw if somehow the invariants of `user` having a `game` attribute and the `game` attribute either being `None` of having a `type` attribute in `[0, 1, 2, 3]` are broken. * Update general.py --- redbot/cogs/general/general.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redbot/cogs/general/general.py b/redbot/cogs/general/general.py index 4655de123..55d5d1ee0 100644 --- a/redbot/cogs/general/general.py +++ b/redbot/cogs/general/general.py @@ -215,11 +215,11 @@ class General: created_on = _("{}\n({} days ago)").format(user_created, since_created) joined_on = _("{}\n({} days ago)").format(user_joined, since_joined) - + game = _("Chilling in {} status").format(user.status) - - # Check if the user has a special status - if user.game.type == 0: # "Playing" status + if user.game is None: # Default status + pass + elif user.game.type == 0: # "Playing" status game = _("Playing {}").format(user.game.name) elif user.game.type == 1: # "Streaming" status game = _("Streaming [{}]({})").format(user.game.name, user.game.url)