[DRAFT] feat(interaction): added user & channel options to command options#32
Draft
lizclipse wants to merge 5 commits intoSwiftcordApp:mainfrom
Draft
[DRAFT] feat(interaction): added user & channel options to command options#32lizclipse wants to merge 5 commits intoSwiftcordApp:mainfrom
lizclipse wants to merge 5 commits intoSwiftcordApp:mainfrom
Conversation
Member
|
You're off to a great start! I feel that including the API |
2d01d66 to
46dbc4b
Compare
Author
|
I stopped working on this because I stopped working on the bot I have (it's just a for-fun one), but I'm back at it and will try to update this a bit more. Will want to actually try out the interaction changes before marking the PR as ready, tho. Just as an aside, does this project have any formatter set up? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
UserOptionto allow slash commands to select and target users.This is a draft currently, as (a) I'm still ramping up on Swift (making a Discord bot is my first real use of it), and (b) while this functions, it is less than ideal, as the interaction data provides all of the user information but this currently only gives the ID to consuming code. Ideally, it should pull out the user data and make it available to users of the package nicely, but for now it's working as an MVP so I can actually use it.
As to why I've opened the PR, mostly it's so I can get a 'no don't do that' early on if I'm going down the wrong path, and possibly to look at expanding it out to adding more of the options as well.
I've also tweaked the
BotMessageclass as well, since there's a lot of useful info in theMessagethat seems to get thrown away (e.g. I want access to the author ID, as I want to filter out messages created by the bot itself when using thecreateChannelMsgmethod). If this isn't wanted, I'll revert it, not exactly attached to it.For future reference (mostly for myself), this is an example interaction object (with all sensitive values stripped out):
Interaction Object
{ "t": "INTERACTION_CREATE", "s": 3, "op": 0, "d": { "version": 1, "type": 2, "token": "(string)", "member": { "user": { "username": "(string)", "public_flags": 0, "id": "(snowflake)", "global_name": "(string)", "discriminator": "0", "avatar_decoration": null, "avatar": "(string)" }, "unusual_dm_activity_until": null, "roles": [ "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)" ], "premium_since": null, "permissions": "(stringified int)", "pending": false, "nick": "(string)", "mute": false, "joined_at": "(ISO datetime)", "flags": 0, "deaf": false, "communication_disabled_until": null, "avatar": null }, "locale": "en-GB", "id": "(snowflake)", "guild_locale": "ru", "guild_id": "(snowflake)", "guild": { "locale": "ru", "id": "(snowflake)", "features": [ "THREE_DAY_THREAD_ARCHIVE", "SEVEN_DAY_THREAD_ARCHIVE", "MEMBER_PROFILES", "BANNER", "ROLE_ICONS", "PRIVATE_THREADS", "INVITE_SPLASH", "ANIMATED_ICON" ] }, "entitlements": [], "entitlement_sku_ids": [], "data": { "type": 1, "resolved": { "users": { "(snowflake#1)": { "username": "(string)", "public_flags": 64, "id": "(snowflake#1)", "global_name": "(string)", "discriminator": "0", "avatar_decoration": null, "avatar": "(string)" } }, "members": { "(snowflake#1)": { "unusual_dm_activity_until": null, "roles": [ "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)", "(snowflake)" ], "premium_since": null, "permissions": "(stringified int)", "pending": false, "nick": "(string)", "joined_at": "(ISO datetime)", "flags": 0, "communication_disabled_until": null, "avatar": null } } }, "options": [ { "value": "(snowflake#1)", "type": 6, "name": "target" } ], "name": "(string:command name)", "id": "(snowflake)", "guild_id": "(snowflake)" }, "channel_id": "(snowflake)", "channel": { "type": 0, "topic": "(string)", "rate_limit_per_user": 0, "position": 46, "permissions": "(stringified int)", "parent_id": "(snowflake)", "nsfw": true, "name": "(string)", "last_pin_timestamp": "(ISO datetime)", "last_message_id": "(snowflake)", "id": "(snowflake)", "guild_id": "(snowflake)", "flags": 0 }, "application_id": "(snowflake)", "app_permissions": "(stringified int)" } }