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

Add methods for getting, editing, and deleting a message via webhook. #1026

Merged
merged 29 commits into from
Nov 7, 2021

Conversation

j0rdanit0
Copy link
Sponsor Contributor

@j0rdanit0 j0rdanit0 commented Oct 11, 2021

Description:
Adds 3 missing helper methods in the Webhook class:

  • getMessage()
  • editMessage()
  • deleteMessage()

Adds WebhookMessageEditSpecGenerator and WebhookMessageEditMonoGenerator to support new methods

Justification:
These documented routes already exist in the WebhookService, but have not yet been added to the Webhook class for easier execution.

Note:
When creating the spec/mono generator, I may have broken some conventions, so please advise any changes I should make. Particularly for this reason:

  • Should Webhook#editMessage accept the messageId as a required parameter, separately from the WebhookMessageEditSpec, since the call will not work without one? As it is now, the messageId has to be set in the spec, and then it is validated to be non-null upon execution. Or, because messageId is a path variable rather than a member of the request body, should it even be included in the spec at all? For example, the 2 webhook fields aren't included in the spec.

Thanks for your consideration.

quanticc and others added 18 commits September 26, 2021 20:38
* Modify channel hierarchy in preparation for threads

* Use 'TopLevel' names instead of temp names, remove duplicate docs

* Add deprecation docs

* Add class docs

* Make CategorizableChannel extend TopLevelGuildChannel

* Make breaking channel hierarchy changes

* (Re)move methods deprecated in preparation for threads
* Move most base channel method implementations to default methods
* Remove most base channel classes

* Don't deprecate GuildChannel#getEffectivePermissions

* Remove BaseTopLevelGuildChannel, add license headers, docs

* Remove unused imports

* Remove unused imports

Co-authored-by: quanticc <abarcab.ivan@gmail.com>
* Initial work on threads

* More work on threads

* Modify channel hierarchy in preparation for threads

* Use 'TopLevel' names instead of temp names, remove duplicate docs

* Add deprecation docs

* Add class docs

* Make CategorizableChannel extend TopLevelGuildChannel

* Make breaking channel hierarchy changes

* (Re)move methods deprecated in preparation for threads
* Move most base channel method implementations to default methods
* Remove most base channel classes

* Don't deprecate GuildChannel#getEffectivePermissions

* Remove BaseTopLevelGuildChannel, add license headers, docs

* Remove unused imports

* Remove unused imports

* Use new channel hierarchy
Add spec/mono generators for editing and deleting a message via webhook.
Add new interface VoidSpec that provides a default implementation of asRequest that returns null.
Remove WebhookMessageDeleteSpecGenerator.java
Add Webhook#executeMessageGet
Copy link
Sponsor Member

@NovaFox161 NovaFox161 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read through all of this closely yet, just noticed the license headers missing on new files

@j0rdanit0 j0rdanit0 changed the title Add methods for editing and deleting a message via webhook. Add methods for getting, editing, and deleting a message via webhook. Oct 14, 2021
@quanticc quanticc added this to the 3.2.1 milestone Oct 16, 2021
@quanticc quanticc added area/core Related to core module: events, entities, clients, specs enhancement Improvement over an existing feature labels Oct 16, 2021
Copy link
Member

@quanticc quanticc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. I have a small request, can you rename the methods in Webhook to:

  • getMessage
  • editMessage
  • deleteMessage

@j0rdanit0
Copy link
Sponsor Contributor Author

@quanticc thanks, the method names have been updated now. Should the name of WebhookMessageEditSpec and Mono be updated as well? To WebhookEditMessageSpec and Mono

@j0rdanit0
Copy link
Sponsor Contributor Author

Dang I merged master in. I'll revert that tomorrow when I'm not on my phone lol

Copy link
Member

@quanticc quanticc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@quanticc quanticc merged commit 9b60592 into Discord4J:3.2.x Nov 7, 2021
quanticc added a commit that referenced this pull request Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to core module: events, entities, clients, specs enhancement Improvement over an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants