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

Handle messages from inaccessible threads and add webhook support #2390

Merged
merged 35 commits into from
Oct 15, 2023

Conversation

MinnDevelopment
Copy link
Member

@MinnDevelopment MinnDevelopment commented Feb 2, 2023

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

Adds support for sending webhook messages and handle interactions from hidden threads.

Summary

  • Added WebhookClient.createClient(jda, url), which allows sending webhook messages
  • Added InteractionHook.from(jda, interactionToken), which allows sending followup messages for interactions
  • Adjusted Message to be usable without a channel or guild. This is necessary for WebhookClient and InteractionHook, where the channel is potentially not reachable by the bot.
  • Added Message#hasChannel and Message#hasGuild to check whether a channel or guild is provided by the message instance
  • Adjusted MessageReaction accordingly
  • Handle interactions in hidden threads (private or missing access to parent), by creating the thread using the interaction channel objects
  • Reject all interactions from group DMs for the time being
  • Remove SystemMessage in favor of simple checks in ReceivedMessage
  • The EntityBuilder now has new methods for creating messages in webhooks:
    • createMessageFromWebhook creates a message instance without a channel, but potentially a guild instance
    • createMessageBestEffort creates a message instance based on the provided channel and guild (or null in case of not being accessible)

@MinnDevelopment MinnDevelopment added type: enhancement type: semi-breaking this might change internals in a non-comptible way labels Feb 2, 2023
…essages

# Conflicts:
#	src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
#	src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
#	src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java
#	src/main/java/net/dv8tion/jda/internal/handle/InteractionCreateHandler.java
#	src/main/java/net/dv8tion/jda/internal/interactions/InteractionHookImpl.java
@MinnDevelopment MinnDevelopment marked this pull request as ready for review May 20, 2023 12:49
@MinnDevelopment MinnDevelopment changed the title Interactions in uncached threads Handle messages from unknown sources May 20, 2023
@MinnDevelopment MinnDevelopment changed the title Handle messages from unknown sources Handle messages from uncached sources May 20, 2023
@MinnDevelopment MinnDevelopment added the beta-blocker Should be merged before dropping beta classification label Jun 30, 2023
@MinnDevelopment MinnDevelopment changed the title Handle messages from uncached sources Handle messages from inaccessible threads and add webhook support Oct 15, 2023
@MinnDevelopment MinnDevelopment merged commit 2d97b27 into master Oct 15, 2023
1 check passed
@MinnDevelopment MinnDevelopment deleted the patch-interaction-messages branch October 15, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-blocker Should be merged before dropping beta classification type: enhancement type: semi-breaking this might change internals in a non-comptible way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants