From 1e982e0042ae6c50e59b9b77fb77aa6f361ef0e9 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 25 Jun 2019 21:50:06 -0400 Subject: [PATCH] Cast activity enumerator to integer instead of accessing value directly Should make the library more resilient to future changes. --- discord/activity.py | 2 +- discord/enums.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/discord/activity.py b/discord/activity.py index 692e20e9c..3acc046d3 100644 --- a/discord/activity.py +++ b/discord/activity.py @@ -175,7 +175,7 @@ class Activity(_ActivityTag): continue ret[attr] = value - ret['type'] = self.type.value + ret['type'] = int(self.type) return ret @property diff --git a/discord/enums.py b/discord/enums.py index ddabbe72b..5fec3a02a 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -380,6 +380,9 @@ class ActivityType(Enum): listening = 2 watching = 3 + def __int__(self): + return self.value + class HypeSquadHouse(Enum): bravery = 1 brilliance = 2