-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
Mentionables #533
Mentionables #533
Conversation
Pulling latest
The DiscordMentions will be for internal user and the Mentions interface will be exposed on message functions.
Edits don't effect pings - Emzi
This will need to be added to webhooks too I suppose |
They didn't have the mentions and now they do. They are added as optionals for backwards compatability.
d#mention will trigger some user mentions for testing.
Needs discussion. In short the Parse and User Ids are mutually exclusive. I have added the ability to supply no ID and that will be considered as "Parse all users", and the ability to supply an ID which will be "Parse this specific user". According to the documentation, having both Parse Users and Specified Users is a validation error and will throw 400: Bad Request. The solution I used was to always use Parse Users when available and ignoring the Specified Users, but this maybe not desired outcome? Please discuss.
What is the best way to handle the following: We may want to throw an exception if we detect both Parse and User/Roles present, or we could just let it throw the 400: Bad Request. |
I confused myself with the Everyone mention. I assumed it would allow me to mention everyone I listed but it is only specifically for the @ everyone and @ here. I rewrote the documentation to be more clear about all the fields.
I'll put this as on hold for (reason being, it's not yet finalized) now so that nobody accidentally merges this. |
Maxine suggested to add Everyone static. I believe All is more appropriately suited though. Unsure about EveryoneMention.All however. I implemented it for consistency with the others but it isn't required.
Tested it and it works. Updated the notes in original PR. |
Interface looks OK. I wonder how long until we have to switch to a message builder 😔. |
* Initial Mentions and DiscordMentions The DiscordMentions will be for internal user and the Mentions interface will be exposed on message functions. * Added Mentions to the payload * Sealed interface * Added exception * Added CreateMessage * Added mentions to UploadFileAsync * Moved to Create Payload Edits don't effect pings - Emzi * Added mentions to webhooks They didn't have the mentions and now they do. They are added as optionals for backwards compatability. * Fixed build failure. * Added test command d#mention will trigger some user mentions for testing. * Updated Mentions to work, Needs discussion. In short the Parse and User Ids are mutually exclusive. I have added the ability to supply no ID and that will be considered as "Parse all users", and the ability to supply an ID which will be "Parse this specific user". According to the documentation, having both Parse Users and Specified Users is a validation error and will throw 400: Bad Request. The solution I used was to always use Parse Users when available and ignoring the Specified Users, but this maybe not desired outcome? Please discuss. * Updated Documentation I confused myself with the Everyone mention. I assumed it would allow me to mention everyone I listed but it is only specifically for the @ everyone and @ here. I rewrote the documentation to be more clear about all the fields. * Added All static. Maxine suggested to add Everyone static. I believe All is more appropriately suited though. Unsure about EveryoneMention.All however. I implemented it for consistency with the others but it isn't required.
* Initial Mentions and DiscordMentions The DiscordMentions will be for internal user and the Mentions interface will be exposed on message functions. * Added Mentions to the payload * Sealed interface * Added exception * Added CreateMessage * Added mentions to UploadFileAsync * Moved to Create Payload Edits don't effect pings - Emzi * Added mentions to webhooks They didn't have the mentions and now they do. They are added as optionals for backwards compatability. * Fixed build failure. * Added test command d#mention will trigger some user mentions for testing. * Updated Mentions to work, Needs discussion. In short the Parse and User Ids are mutually exclusive. I have added the ability to supply no ID and that will be considered as "Parse all users", and the ability to supply an ID which will be "Parse this specific user". According to the documentation, having both Parse Users and Specified Users is a validation error and will throw 400: Bad Request. The solution I used was to always use Parse Users when available and ignoring the Specified Users, but this maybe not desired outcome? Please discuss. * Updated Documentation I confused myself with the Everyone mention. I assumed it would allow me to mention everyone I listed but it is only specifically for the @ everyone and @ here. I rewrote the documentation to be more clear about all the fields. * Added All static. Maxine suggested to add Everyone static. I believe All is more appropriately suited though. Unsure about EveryoneMention.All however. I implemented it for consistency with the others but it isn't required.
Summary
Added support for Mentionables
Details
Adds support for Discord's new mentionables. https://discordapp.com/developers/docs/resources/channel#allowed-mentions-object
Changes proposed
IEnumerable<IMention>
Notes
Tested and it works. There is a edge case to account for:
If a user says they want to whitelist a specific user AND allow all user mentions.
The discord API will throw a bad request if this is sent. I am currently just ignoring the specific whitelist and assuming the user actually wanted the allow all user mentions. Is this the best case?