Skip to content

Commit 3d44321

Browse files
add audit log reason to requests that support it
1 parent 4e3fab0 commit 3d44321

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

botstrap.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ def create_forum_channel(self, channel_name_: str, category_id_: int | str | Non
171171
if category_id_:
172172
payload["parent_id"] = category_id_
173173

174-
response = self.post(f"/guilds/{self.guild_id}/channels", json=payload)
174+
response = self.post(
175+
f"/guilds/{self.guild_id}/channels",
176+
json=payload,
177+
headers={"X-Audit-Log-Reason": "Creating forum channel as part of PyDis botstrap"},
178+
)
175179
forum_channel_id = response.json()["id"]
176180
log.info(f"New forum channel: {channel_name_} has been successfully created.")
177181
return forum_channel_id
@@ -227,7 +231,11 @@ def create_webhook(self, name: str, channel_id_: int) -> str:
227231
"""Creates a new webhook for a particular channel."""
228232
payload = {"name": name}
229233

230-
response = self.post(f"/channels/{channel_id_}/webhooks", json=payload)
234+
response = self.post(
235+
f"/channels/{channel_id_}/webhooks",
236+
json=payload,
237+
headers={"X-Audit-Log-Reason": "Creating webhook as part of PyDis botstrap"},
238+
)
231239
new_webhook = response.json()
232240
return new_webhook["id"]
233241

0 commit comments

Comments
 (0)