Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: webhook URL parse #221

Merged
merged 3 commits into from Dec 17, 2022
Merged

feat: webhook URL parse #221

merged 3 commits into from Dec 17, 2022

Conversation

jolheiser
Copy link
Contributor

Considering Discord doesn't show you the webhook URL and has you copy it as-is, this is a convenience func for parsing a webhook URL wholesale.

As far as I know, they come in the form https://discord.com/api/webhooks/123456789123456789/foo (without an API version), at least in from the UI, so this somewhat naively assumes that splitting the URL should yield the ID/token in the 3/4 index respectively.

An alternative would be to instead do a backwards grab of the last two indexes rather than assume 3/4.
Let me know if you'd prefer that instead.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: ToπSenpai <15636011+TopiSenpai@users.noreply.github.com>
webhook/webook_test.go Outdated Show resolved Hide resolved
Co-authored-by: ToπSenpai <15636011+TopiSenpai@users.noreply.github.com>
@topi314 topi314 merged commit 0349a88 into disgoorg:development Dec 17, 2022
@jolheiser jolheiser deleted the parse-url branch December 17, 2022 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants