-
Notifications
You must be signed in to change notification settings - Fork 13
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
Slash Commands, Message Components, and Interactions #31
base: master
Are you sure you want to change the base?
Conversation
- Mappings & REST methods for application command - Mappings & REST methods for interactions - Mappings for message components - INTERACTION_CREATE gateway event
- Update examples to conform this changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts I noticed during a first quick glance.
8d21237
to
f082168
Compare
…into interactions
…into interactions
ccff49b
to
4b56412
Compare
Working on to add support for permissions v2, but I'm not sure how I should implement Relevant doc: https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions |
The request method already takes headers as an argument. diff --git a/src/discordcr/rest.cr b/src/discordcr/rest.cr
index 5fcb123..6ef619d 100644
--- a/src/discordcr/rest.cr
+++ b/src/discordcr/rest.cr
@@ -22,7 +22,9 @@ module Discord
mutexes = (@mutexes ||= Hash(RateLimitKey, Mutex).new)
global_mutex = (@global_mutex ||= Mutex.new)
- headers["Authorization"] = @token
+ unless headers["Authorization"]?
+ headers["Authorization"] = @token
+ end
headers["User-Agent"] = USER_AGENT
headers["X-RateLimit-Precision"] = "millisecond" and then within the edit_application_permissions method, just pass in a custom authorization header with a bearer token. |
Oh, you're right. Seems like I just didn't read the code. |
Hi :) Sorry that it's been so long since there's been any activity! Would it be possible to add a couple of specs for this? Otherwise, I didn't see any issues with the code, but I'm also the most junior developer on hand, so take that with a grain of salt. |
Hi, thanks for taking your time to look through my PR. And yes, I can definitely add some specs for it, but I can't exactly tell when it will be ready. I think I will have some time by the end of this month, so hopefully it will be ready in the next month or so. |
Awesome! I mean, after the response time to your PR taking a couple weeks is definitely no problem! Thanks for your support for the library! :) |
I've added some specs for the structs that require custom json parsing, please let me know if there's anything missing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
@PixeLInc do you think you'll have time to review this at some point? I don't feel confident/knowledgeable enough to truly approve this. |
Everything seems to be good and functional. Any idea why I'd get a 401 when trying to bulk overwrite global application commands though? |
Thanks for looking through the PR! |
@soya-daizu I knew it had to be something stupid like that. Of course adding the |
EDIT(Oct. 2022): I'm still around and the branch is still being maintained with support of the newer interaction related features. Please report any issues if you found any!
Now that #19 and #20 are being kinda dead, here's my attempt to implement all these features. The added lines are about a quarter of that in #19 and #20 combined, and while some part of the code may not be the best, at least I will try to be active as I can and address any problems pointed out.
This is the first time for me to implement all this stuff while reading docs, and the changes ended up pretty big still, so I would like to have some feedback first.
Some notes about the changes:
PartialApplicationCommand
id
and other fields that are not used when registeringPartialGuildMember
deaf
andmute
fields