Simplify getWebhook to use .find() instead of foreach logic

This commit is contained in:
Aster Fialla
2026-02-24 19:52:29 -05:00
parent fb878222dd
commit 102d694240

View File

@@ -90,13 +90,7 @@ wh.getWebhook = async function(client, channel) {
if (channelWebhooks.length === 0) {
return;
}
let pf_webhook;
channelWebhooks.forEach((webhook) => {
if (webhook.name === name) {
pf_webhook = webhook;
}
})
return pf_webhook;
return channelWebhooks.find((webhook) => webhook.name === name);
}
export const webhookHelper = wh;