Open freya022 opened 5 months ago
There seems to be a caching issue
If two different people use the same command in the same dm then all subsequent event.getUser()
will return whoever used the command first.
There seems to be a caching issue If two different people use the same command in the same dm then all subsequent
event.getUser()
will return whoever used the command first.
Should be fixed
I am not sure if this is an issue on my code or the library
but updating attachments with editOriginalAttachments
doesn't actually cause it to update unless you restart your discord
it's not an issue on my client as it also occurs for other people
I am not sure if this is an issue on my code or the library but updating attachments with
editOriginalAttachments
doesn't actually cause it to update unless you restart your discordit's not an issue on my client as it also occurs for other people
As you mentioned, restarting the client fixes the issue, so it's not a JDA issue
I really doubt it's not a JDA issue, it works in other discord frameworks
Replying to an interaction using reply
and then editing the original hook's attachments just doesn't work on JDA (well it does but discord doesn't update it)
sigh at this point I just give up, I have to resort to putting my image in an embed (by using .setImage("attachment://" + fileName)
)
I really hate how images in embeds get scaled down but that's a discord problem
the thing that annoys me the most is that it used to work, I don't know what changed nor do I know if it's something to do with your new changes
Can't repro with the code below, please share minimal reproduction code if you can
public void onSlashReplyEditAttachment(SlashCommandInteractionEvent event, Message.Attachment attachment, Message.Attachment attachment2) throws Exception {
final byte[] bytes = getBytes(attachment);
final byte[] bytes2 = getBytes(attachment2);
event.replyFiles(FileUpload.fromData(bytes, attachment.getFileName()))
.setEphemeral(true) // Tried without ephemeral too
.queue();
event.getHook()
.editOriginalAttachments(FileUpload.fromData(bytes2, attachment.getFileName()))
.queue();
}
private byte[] getBytes(Message.Attachment attachment) throws Exception {
try (InputStream stream = attachment.getProxy().download().get()) {
return stream.readAllBytes();
}
}
Maybe a UserJoinEvent(like GuildJoinEvent for userapps) and a JDA.getInstalledAppUsers()(like JDA.getGuilds() for userapps)
Maybe a UserJoinEvent(like GuildJoinEvent for userapps) and a JDA.getInstalledAppUsers()(like JDA.getGuilds() for userapps)
Discord doesn't have a way to get who installed the application on their accounts
As a reminder, JDA adds what Discord documents, if it isn't in the Discord docs, we can't add it
I don't know if it's a limitation from Discord API, however, when trying to use
SlashCommandInteractionEvent#getGuild().getLocale()
on a command ran as user-app, it always returns ENGLISH_US
, even when the server is a community server set to another locale. Tested on small and large servers
I have been running this PR in production since 24/07 and I haven't found any issues, thanks freya! pets the freya
Is this arriving any time soon?
This will be merged once the maintainers have time to review it, in the meantime you can install a preview by following the instructions in the PR description
I'm running this fork since 25/8, @freya022 did a great job here, congrats and cheers!
I got my bot using it in prod as well for most commands, working just fine
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
This adds support for user-installable apps (Preview, Release).
You are able to create application commands using the new properties, read the new data structures provided in
ApplicationInfo
,Interaction
andMessage
, as well as responding to interactions in detached guilds (where your bot isn't it in) and group DMs.Interesting elements include:
(Slash)CommandData#setContexts
(Default:GUILD
andBOT_DM
)(Slash)CommandData#setIntegrationTypes
(Default:GUILD_INSTALL
)IDetachableEntity#isDetached
(forGuild
,Channel
,Role
,Member
...)Interaction#hasFullGuild
Interaction#getIntegrationOwners
Message#getInteractionMetadata
Note: The default contexts and integration types align with the current behavior, meaning there is no breaking change.
You can see examples here, you can also see the example changes in the
Files changed
tab.Installation (Preview)
You can use the "Using new features" guide from the JDA wiki.
Alternatively, you can get the newest version for your favorite tool, by using the
/jitpack pr
command in the JDA Discord server. You can use theUpdate PR
button to merge the latest changes if necessary (note that it may not update it if there are conflicts).