aboutsummaryrefslogtreecommitdiff
path: root/discord/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/utils.py')
-rw-r--r--discord/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 06aa5a35..d7b04503 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -281,3 +281,7 @@ def sane_wait_for(futures, *, timeout, loop):
if len(pending) != 0:
raise asyncio.TimeoutError()
+
+def valid_icon_size(size):
+ """Icons must be power of 2 within [16, 1024]."""
+ return ((size != 0) and not (size & (size - 1))) and size in range(16, 1025)