Skip to content

Commit f066a04

Browse files
committed
fix editing and deleting messages with a thread id
1 parent abeaa32 commit f066a04

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

CHANGES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## development
44

5+
## 2025-03-04 1.4.0
6+
7+
### 🎉 Features
8+
- `set_timestamp()` accepts also a string
9+
- add support for `flags`
10+
11+
### 🩹 Fixes
12+
- CLI requires one webhook url
13+
- fix editing and deleting messages with a `thread_id`
14+
515
## 2024-01-31 1.3.1
616

717
### 🩹 Fixes

discord_webhook/async_webhook.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ async def edit(self) -> "httpx.Response":
136136
if bool(self.files) is False:
137137
patch_kwargs = {
138138
"json": self.json,
139-
"params": {"wait": True},
139+
"params": self._query_params,
140140
"timeout": self.timeout,
141141
}
142142
else:
143143
self.files["payload_json"] = (None, json.dumps(self.json))
144-
patch_kwargs = {"files": self.files, "timeout": self.timeout}
144+
patch_kwargs = {
145+
"files": self.files,
146+
"params": self._query_params,
147+
"timeout": self.timeout,
148+
}
145149
request = partial(client.patch, url, **patch_kwargs)
146150
response = await request()
147151
if response.status_code in [200, 204]:
@@ -171,7 +175,9 @@ async def delete(self) -> "httpx.Response":
171175
), "Webhook URL needs to be set in order to delete the webhook."
172176
url = f"{self.url}/messages/{self.id}"
173177
async with self.http_client as client: # type: httpx.AsyncClient
174-
response = await client.delete(url, timeout=self.timeout)
178+
response = await client.delete(
179+
url, params=self._query_params, timeout=self.timeout
180+
)
175181
if response.status_code in [200, 204]:
176182
logger.debug("Webhook deleted")
177183
else:

discord_webhook/webhook.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def edit(self) -> "requests.Response":
485485
url,
486486
json=self.json,
487487
proxies=self.proxies,
488-
params={"wait": True},
488+
params=self._query_params,
489489
timeout=self.timeout,
490490
)
491491
else:
@@ -525,7 +525,11 @@ def delete(self) -> "requests.Response":
525525
), "Webhook URL needs to be set in order to delete the webhook."
526526
url = f"{self.url}/messages/{self.id}"
527527
request = partial(
528-
requests.delete, url, proxies=self.proxies, timeout=self.timeout
528+
requests.delete,
529+
url,
530+
proxies=self.proxies,
531+
params=self._query_params,
532+
timeout=self.timeout,
529533
)
530534
response = request()
531535
if response.status_code in [200, 204]:

0 commit comments

Comments
 (0)