ensureWebhook

suspend fun GuildChannelBehavior.ensureWebhook(name: String, logoFormat: Image.Format = Image.Format.PNG, logo: suspend () -> ByteArray? = null): Webhook

Ensure a webhook is created for the bot in a given channel, and return it.

If a webhook already exists with the given name, it will be returned instead.

Return

Webhook object for the newly created webhook, or the existing one if it is already there.

Parameters

name

Webhook name.

logoFormat

Optional image format object — defaults to PNG.

logo

Optional callable returning logo image data for the newly created webhook.


@JvmName(name = "_ensureWebhook")
suspend fun ensureWebhook(channelObj: GuildChannelBehavior, name: String, logoFormat: Image.Format = Image.Format.PNG, logo: suspend () -> ByteArray? = null): Webhook

Deprecated

Replaced with an extension function for consistency and discoverability.

Replace with

channelObj.ensureWebhook(name, logoFormat, logo)