forked from PluralFlux/PluralFlux
Simplify getWebhook to use .find() instead of foreach logic
This commit is contained in:
@@ -90,13 +90,7 @@ wh.getWebhook = async function(client, channel) {
|
|||||||
if (channelWebhooks.length === 0) {
|
if (channelWebhooks.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let pf_webhook;
|
return channelWebhooks.find((webhook) => webhook.name === name);
|
||||||
channelWebhooks.forEach((webhook) => {
|
|
||||||
if (webhook.name === name) {
|
|
||||||
pf_webhook = webhook;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return pf_webhook;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const webhookHelper = wh;
|
export const webhookHelper = wh;
|
||||||
Reference in New Issue
Block a user