Functioncorev0.14.0Decorator
WebhookUrl
Declares where a WebhookLog reporter reads its webhook url.
A string is the name of an environment variable. A function returns the url, which lets you read it from any
module of yours. If the variable is unset or the function returns undefined, the reporter will be off and the
bot will warn at boot. A url that isn't a Discord webhook url throws at boot.
WebhookUrl(
source: string | (() => string | undefined)
): <Keys extends SubscriptionKey>(
constructor: Constructor<WebhookLog<Keys, CoreBase>>
) => void\@Subscribe(['memberBanned'])
\@WebhookUrl('BAN_LOG_WEBHOOK_URL')
class BanLog extends WebhookLog<'memberBanned'> {
report() {
return { components: [new BanCard(this.data).component] };
}
}
// or return it from a settings module of your own
\@WebhookUrl(() => settings.banLogWebhook)