blob: 73a227c94e01d82147f5c4cd189941a05d2bac95 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
/**
* 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: string) => {
const regex = /https:\/\/discordapp\.com\/api\/webhooks\/(\d{1,})\/([\w-_]{1,})/;
const matches = regex.exec(url);
//@ts-ignore dont care if null
return { id: matches[1], token: matches[2] };
};
|