MCPcopy Create free account
hub / github.com/Botloader/botloader / editWebhookWithToken

Function editWebhookWithToken

components/runtime/src/ts/discord/dapi.ts:1272–1295  ·  view source on GitHub ↗
(id: string, token: string, fields: Omit<EditWebhookFields, "channel_id">)

Source from the content-addressed store, hash-verified

1270}
1271
1272export 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
1297export async function deleteWebhook(id: string, token?: string) {
1298 await OpWrappers.callAsyncOp({

Callers 1

editMethod · 0.90

Calls 2

dataUriMethod · 0.80
fromInternalMethod · 0.45

Tested by

no test coverage detected