aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-02-21 08:19:32 -0500
committerRapptz <[email protected]>2017-02-21 08:19:32 -0500
commit702d596af964bf348fd02b31ca61f255b19f2ea3 (patch)
tree94a8d986e68bc223af67e98c9bb93e48f9478161
parentReconnect when a task times out and propagates. (diff)
downloaddiscord.py-702d596af964bf348fd02b31ca61f255b19f2ea3.tar.xz
discord.py-702d596af964bf348fd02b31ca61f255b19f2ea3.zip
Check that the type in Colour and Permissions are int.
-rw-r--r--discord/colour.py5
-rw-r--r--discord/permissions.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/discord/colour.py b/discord/colour.py
index b8ee5dae..9f104451 100644
--- a/discord/colour.py
+++ b/discord/colour.py
@@ -46,13 +46,16 @@ class Colour:
Attributes
------------
- value : int
+ value: int
The raw integer colour value.
"""
__slots__ = ('value',)
def __init__(self, value):
+ if not isinstance(value, int):
+ raise TypeError('Expected int parameter, received %s instead.' % value.__class__.__name__)
+
self.value = value
def _get_byte(self, byte):
diff --git a/discord/permissions.py b/discord/permissions.py
index c8c8ae37..ee946ff6 100644
--- a/discord/permissions.py
+++ b/discord/permissions.py
@@ -69,6 +69,9 @@ class Permissions:
__slots__ = ('value',)
def __init__(self, permissions=0):
+ if not isinstance(permissions, int):
+ raise TypeError('Expected int parameter, received %s instead.' % permissions.__class__.__name__)
+
self.value = permissions
def __eq__(self, other):