blob: fa8c240a9ce4752e70087d4e1faf94fc7fd481fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
/**
* Gets the ID and token for a webhook from a webhook URL from the Discord client
* @param {string} url URL for the webhook from the Discord client
* @returns {Object} Object with the webhook ID and token
*/
module.exports = url => {
const regex = /https:\/\/discordapp\.com\/api\/webhooks\/(\d{1,})\/([\w-_]{1,})/;
const matches = regex.exec(url);
return { id: matches[1], token: matches[2] };
};
|