-
-
Notifications
You must be signed in to change notification settings - Fork 318
Fix/v4/slashies-cleanup custom converter support #1382
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
Fix/v4/slashies-cleanup custom converter support #1382
Conversation
…dMember objects (#1359)
#1364) * Fix memberBefore missing roles in GuildMemberUpdateEventArgs when not in cache * Update cached guild member in OnGuildMemberUpdateEventAsync internal event handler * Update DiscordClient.Dispatch.cs Co-authored-by: Lunar Starstrum <lunar@forsaken-borders.net>
* Ported CommandsNext cooldown attribute to Slash Commands; Fixed compiler warnings and suggestions * Still untested; Attempted to resolve @Erisa's review
…ledException (previously Exception)
- No, I did not implement the checks in the converters. I felt that should be done in a separate area of code - Yes, I did break my Enter, Backspace, D and Apostrophe keys because of this PR. Don't ask how.
…n)register converter methods (untested).
|
I have done minimum testing with these changes and can confirm that my slash commands are correctly functioning with full built-in converter support. I have not tested external converter support, though in theory it should work as intended unless if the (un)register converter methods break. |
For legal reasons, this is a joke. - Fork DSharpPlus and make changes to include a public argument converter system until DSharpPlus/DSharpPlus#1382 and https://github.com/DSharpPlus/DSharpPlus/tree/fix/v4/slashies-cleanup are merged. This fork is not intended to be redistributed or maintained. Modification to this fork may only be done by me and only I may use this fork. - Submodule my fork of DSharpPlus into libs/DSharpPlus - Move `src/` to `Tomoe/src/` and add it to the newly created SLN file - Remake `/raw` to use the new argument conversion system.
Naamloos
left a comment
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.
Now here is something interesting to consider:
Should an enum argument type also implement an autofill service on the library's end?
|
Assuming we're both referencing Slash Command Choices (the list of valid arguments defined by the bot), yes Enums should be handled differently and should register the choices. I believe the current slash commands extension does this and my changes would actually the break current behavior. I'll fix this |
|
Latest commit has fixed choices not being registered from enums (tested). I also added number-like converters for sbyte, short, int along with their unsigned counterparts (ulong included) |
|
|
Naamloos
left a comment
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.
lgtm I really like these changes
|
I'll need someone to test most functionally beside top level slash commands and registering/using custom argument converters. I didn't make many changes but it's better to be sure |
akiraveliara
left a comment
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.
now, for all of the integer converters: i'd prefer, in line with the (BCL)[https://learn.microsoft.com/en-us/dotnet/api/system.buffers.binary.binaryprimitives?view=net-7.0], to use framework names for the type they convert (citing one example here).
if not, i'd use the keywords, that is UnsignedInt -> UInt.
also: obligatory tested? does this work with existing slash command setups (specifically nullability)?
DSharpPlus.SlashCommands/Converters/DiscordMessageArgumentConverter.cs
Outdated
Show resolved
Hide resolved
DSharpPlus.SlashCommands/Converters/TimeSpanSlashArgumentConverter.cs
Outdated
Show resolved
Hide resolved
DSharpPlus.SlashCommands/Converters/TimeSpanSlashArgumentConverter.cs
Outdated
Show resolved
Hide resolved
As commented above, no testing was done beyond top level slash commands and registering/using custom argument converters. Some BCL converters have been used (not all).
Nullability should absolutely work. |
|
@akiraveliara all of your comments should be resolved. Is there anything else I should fix before this gets merged into the |
akiraveliara
left a comment
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, without testing yet
Added custom converter support:
Officially passing #1362 onto @ExaInsanity