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

Function editWebhook

components/runtime/src/ts/discord/dapi.ts:1247–1270  ·  view source on GitHub ↗
(id: string, fields: EditWebhookFields)

Source from the content-addressed store, hash-verified

1245}
1246
1247export async function editWebhook(id: string, fields: EditWebhookFields) {
1248 let imageData: string | null | undefined = undefined;
1249 if (fields.avatar) {
1250 if (fields.avatar instanceof Image) {
1251 imageData = fields.avatar.dataUri()
1252 } else {
1253 imageData = fields.avatar
1254 }
1255 } else if (fields.avatar === null) {
1256 imageData = null
1257 }
1258
1259 let resp = await OpWrappers.callAsyncOp({
1260 kind: "discord_webhook_edit",
1261 arg: {
1262 webhook_id: id,
1263 channel_id: fields.channel_id ?? null,
1264 icon: imageData,
1265 name: fields.name ?? null,
1266 }
1267 })
1268
1269 return Webhook.fromInternal(resp)
1270}
1271
1272export async function editWebhookWithToken(id: string, token: string, fields: Omit<EditWebhookFields, "channel_id">) {
1273 let imageData: string | null | undefined = undefined;

Callers 1

editMethod · 0.90

Calls 2

dataUriMethod · 0.80
fromInternalMethod · 0.45

Tested by

no test coverage detected