Skip to content

Commit 3540b26

Browse files
add audit log reason to requests that support it
1 parent f4dfedd commit 3540b26

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
@@ -168,7 +168,11 @@ def create_forum_channel(self, channel_name_: str, category_id_: int | str | Non
168168
if category_id_:
169169
payload["parent_id"] = category_id_
170170

171-
response = self.post(f"/guilds/{self.guild_id}/channels", json=payload)
171+
response = self.post(
172+
f"/guilds/{self.guild_id}/channels",
173+
json=payload,
174+
headers={"X-Audit-Log-Reason": "Creating forum channel as part of PyDis botstrap"},
175+
)
172176
forum_channel_id = response.json()["id"]
173177
log.info(f"New forum channel: {channel_name_} has been successfully created.")
174178
return forum_channel_id
@@ -226,7 +230,11 @@ def create_webhook(self, name: str, channel_id_: int) -> str:
226230
"""Creates a new webhook for a particular channel."""
227231
payload = {"name": name}
228232

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

0 commit comments

Comments
 (0)