Skip to content

Commit 24719c5

Browse files
committed
only check if color is in range if color was set
1 parent f76f67c commit 24719c5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# python-discord-webhook Changes
22

3+
## 2022-05-14 0.16.3
4+
5+
### Fixes
6+
- only check if color is in range if color was set
7+
38
## 2022-05-12 0.16.2
49

510
### Fixes

discord_webhook/webhook.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def set_color(self, color: Union[str, int]) -> None:
100100
:param color: color code of the embed as decimal(int) or hex(string)
101101
"""
102102
self.color = int(color, 16) if isinstance(color, str) else color
103-
if self.color not in range(16777216):
103+
if self.color is not None and self.color not in range(16777216):
104104
raise ColourNotInRangeException(color)
105105

106106
def set_footer(self, **kwargs: str) -> None:
@@ -445,7 +445,6 @@ def edit(
445445
responses: List[requests.Response] = []
446446
for i, webhook in enumerate(sent_webhook):
447447
assert isinstance(webhook.content, bytes)
448-
assert isinstance(webhook.url, str)
449448
previous_sent_message_id = json.loads(webhook.content.decode("utf-8"))["id"]
450449
url = (
451450
webhook.url.split("?")[0] + "/messages/" + str(previous_sent_message_id)
@@ -504,7 +503,6 @@ def delete(
504503
responses: List[requests.Response] = []
505504
for i, webhook in enumerate(sent_webhook):
506505
assert isinstance(webhook.content, bytes)
507-
assert isinstance(webhook.content, str)
508506
url = webhook.url.split("?")[0] # removes any query params
509507
previous_sent_message_id = json.loads(webhook.content.decode("utf-8"))["id"]
510508
response = requests.delete(

0 commit comments

Comments
 (0)