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

Guild object in interactions does not contain preferred_locale #6938

Open
freya022 opened this issue Jun 17, 2024 · 0 comments
Open

Guild object in interactions does not contain preferred_locale #6938

freya022 opened this issue Jun 17, 2024 · 0 comments
Labels
bug slash commands synced Synced to internal tracker

Comments

@freya022
Copy link

Description

When using an interaction, the Guild object does not contain the preferred_locale property, but instead has locale.

Originally reported at discord-jda/JDA#2633 (comment)

Steps to Reproduce

  1. Run a slash command
  2. Look at the guild object provided in the interaction
  3. See there is no preferred_locale, but locale instead

Expected Behavior

The Guild object should have the preferred_locale property, which is the same as the one used in GUILD_CREATE gateway events, and is documented

Current Behavior

It uses a locale property instead

Screenshots/Videos

image

Client and System Information

JDA 5.0.0-beta.24 (c0cff23e36)

freya022 added a commit to freya022/JDA that referenced this issue Jun 17, 2024
@lmle lmle added the synced Synced to internal tracker label Jun 24, 2024
MrPowerGamerBR pushed a commit to LorittaBot/DeviousJDA that referenced this issue Jul 24, 2024
MrPowerGamerBR pushed a commit to LorittaBot/DeviousJDA that referenced this issue Jul 24, 2024
freya022 added a commit to freya022/JDA that referenced this issue Jul 24, 2024
freya022 added a commit to freya022/JDA that referenced this issue Jul 25, 2024
freya022 added a commit to freya022/JDA that referenced this issue Oct 5, 2024
freya022 added a commit to freya022/JDA that referenced this issue Nov 4, 2024
MineKing9534 added a commit to MineKing9534/JDA that referenced this issue Jan 13, 2025
* Add contexts and integration types

* Update tests and examples

* Add ApplicationInfo fields

* Add Interaction fields (context, integration owners)

* Add Message fields (interaction metadata)

* Add IDetachableEntity

* Pull up IPermissionHolder#hasPermission overloads with Collection

* Add concrete entity mixins

Contains common setters used in deserialization

* Add Interaction#hasFullGuild

* Avoid internal types

* Check for detached guilds

* Fix creation of messages in detached guilds

* Remove guild check in interaction creates

* Add IDetachableEntityMixin

* Add detached entities w/ interaction permissions

* Add InteractionEntityBuilder, adapt entity deserialization

* Skip getting select mentions when there's no guild

* Add group channel support

* Add DetachedEntityException

* Document IDetachableEntity

* Add IDetachableEntityMixin to member and role mixins

* Add missing MessageChannelMixin#sendMessageComponents override

* Override detached Member#modifyFlags

* Add missing detached checks, add docs

* Pull up compareTo in roles

* Tell apps are webhooks in Message docs

* Replace user_id with the user object in interaction metadata

* Remove duplicated MessageChannelMixin#sendMessageComponents

* Apply suggestions

* Reword DetachedRoleImpl#getPosition exception

* Remove detached check in StandardGuildMessageChannelMixin#canTalk

It will be thrown by the detached member instead

* Avoid comparing detached roles with attached roles

* Add missing GroupChannel docs

* Add link to Guild#isDetached in docs

* Add MissingEntityInteractionPermissionsException

* Mentions#getMembers typo

* Create a PrivateChannel on every interaction

Fixes the returned (cached) channel having the wrong user

* Fix null author on DMs received from other bots

* Fix nullable fields in group channels

* Set exception message when checking permissions without a channel

* Make context and integration owners non-null

Discord fixed those

* Copy `guild_locale` to the `preferred_locale` of the Guild object

Workaround for discord/discord-api-docs#6938

* Improve docs

* Add IntegrationOwners#toString

* Add ErrorResponse#MAX_FOLLOW_UP_MESSAGES_HIT

* Add Interaction#isUserInstalledInteractionOnly

* Update docs

* Move IDetachableEntity from GuildChannel to Channel

* Check access on Channel#delete

* Add detached private channels (friend DMs)

Also add missing recipient in bot DMs

* Add user-installed slash command example

* Add approximate user install count

* Add Helpers#unmodifiableEnumSet

* Get interaction contexts of deserialized global commands based on dm_permission

Fixes guild-only commands pushed from a previous JDA version
to be deserialized as guild + bot dm commands

* Added target user/message ID in Message#getInteractionMetadata

* Update docs about message references to include context commands

* Add missing DetachedGuildImpl#getSafetyAlertsChannel

* Apply suggestions

- MissingEntityInteractionPermissionsException is an IllegalStateException
- DetachedEntityException is an UnsupportedOperationException
- Use Helpers to format strings

Co-authored-by: Florian Spieß <[email protected]>

* Add IntegrationOwners#isXIntegration()/getXIntegration()

Removes Interaction#isUserInstalledInteractionOnly()
Replaced by !IntegrationOwners#isGuildIntegration

* Reword InteractionContextType docs

* Return EnumSet copies

* Add replacement annotations

* Document exceptions

* Use defaults when reading contexts/integration types from DataObject(s)

* Use `long` for user install count

* Only get private channel recipients from non-empty arrays

* Few adjustments

* Use defaults when reading contexts/integration types from DataObject(s)

* Refactor setting contexts and integration types

* Add missing fields for command edits

* Replace IllegalStateException with DetachedEntityException in PermissionUtil

Also document

* Reword #setEphemeral note

* hasKey -> !isNull

* Read `dm_permission` if command data does not have `contexts`

* Thrown DetachedEntityException rewording

* Better exception explanation for PrivateChannel#retrieveUser?

* Throws before return

* Apply suggestions

Co-authored-by: Florian Spieß <[email protected]>
Co-authored-by: DV8FromTheWorld <[email protected]>

* Separate snowflake getters

* Simplify getting roles in SelectMenuMentions

* Move EntityBuilder assignation to constructor

Makes more sense for initialization order

* Move GroupChannel configuration to common configure method

* Improve `@ReplaceWith` of `isGuildOnly()`

* Remove "say" example, replaced with "echo"

Partial revert of d0d11ac

* Document retrieval of messages by ID using InteractionHook

* Document more cases of ephemeral messages

* Add missing `@see` label

* IntegrationOwners#isGuildIntegration rewording

* Improve IntegrationType docs

* Add `@UnmodifiableView` to `CommandData` collections

* Improve IDetachableEntity docs

* `Interaction#hasFullGuild` -> `isFromAttachedGuild`

* Reword general-purpose `@thrown` DetachedEntityException

* Dont require copied role to be attached

* Reword other `@thrown` DetachedEntityException

* Remove unused example command

---------

Co-authored-by: freya02 <[email protected]>
Co-authored-by: Florian Spieß <[email protected]>
Co-authored-by: DV8FromTheWorld <[email protected]>
freya022 added a commit to freya022/JDA that referenced this issue Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug slash commands synced Synced to internal tracker
Projects
None yet
Development

No branches or pull requests

2 participants