(fields: CreateWebhookFields)
| 1205 | } |
| 1206 | |
| 1207 | export async function createWebhook(fields: CreateWebhookFields) { |
| 1208 | let imageData: string | null = null; |
| 1209 | if (fields.avatar) { |
| 1210 | if (fields.avatar instanceof Image) { |
| 1211 | imageData = fields.avatar.dataUri() |
| 1212 | } else { |
| 1213 | imageData = fields.avatar |
| 1214 | } |
| 1215 | } |
| 1216 | |
| 1217 | let resp = await OpWrappers.callAsyncOp({ |
| 1218 | kind: "discord_webhook_create", |
| 1219 | arg: { |
| 1220 | channel_id: fields.channel_id, |
| 1221 | icon: imageData, |
| 1222 | name: fields.name, |
| 1223 | } |
| 1224 | }) |
| 1225 | |
| 1226 | return Webhook.fromInternal(resp) |
| 1227 | } |
| 1228 | |
| 1229 | |
| 1230 |
nothing calls this directly
no test coverage detected