(id: string, token: string, fields: Omit<EditWebhookFields, "channel_id">)
| 1270 | } |
| 1271 | |
| 1272 | export async function editWebhookWithToken(id: string, token: string, fields: Omit<EditWebhookFields, "channel_id">) { |
| 1273 | let imageData: string | null | undefined = undefined; |
| 1274 | if (fields.avatar) { |
| 1275 | if (fields.avatar instanceof Image) { |
| 1276 | imageData = fields.avatar.dataUri() |
| 1277 | } else { |
| 1278 | imageData = fields.avatar |
| 1279 | } |
| 1280 | } else if (fields.avatar === null) { |
| 1281 | imageData = null |
| 1282 | } |
| 1283 | |
| 1284 | let resp = await OpWrappers.callAsyncOp({ |
| 1285 | kind: "discord_webhook_edit_with_token", |
| 1286 | arg: { |
| 1287 | webhook_id: id, |
| 1288 | token: token, |
| 1289 | icon: imageData, |
| 1290 | name: fields.name ?? null, |
| 1291 | } |
| 1292 | }) |
| 1293 | |
| 1294 | return Webhook.fromInternal(resp) |
| 1295 | } |
| 1296 | |
| 1297 | export async function deleteWebhook(id: string, token?: string) { |
| 1298 | await OpWrappers.callAsyncOp({ |
no test coverage detected