@@ -50,6 +50,19 @@ namespace Discord | |||||
IUser User { get; } | IUser User { get; } | ||||
/// <summary> | /// <summary> | ||||
/// The preferred locale of the invoking User. | |||||
/// </summary> | |||||
string UserLocale { get; } | |||||
/// <summary> | |||||
/// The preferred locale of the guild this interaction was executed in. <see cref="null"/> if not executed in a guild. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. | |||||
/// </remarks> | |||||
string GuildLocale { get; } | |||||
/// <summary> | |||||
/// Responds to an Interaction with type <see cref="InteractionResponseType.ChannelMessageWithSource"/>. | /// Responds to an Interaction with type <see cref="InteractionResponseType.ChannelMessageWithSource"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The text of the message to be sent.</param> | /// <param name="text">The text of the message to be sent.</param> | ||||
@@ -37,5 +37,11 @@ namespace Discord.API | |||||
[JsonProperty("message")] | [JsonProperty("message")] | ||||
public Optional<Message> Message { get; set; } | public Optional<Message> Message { get; set; } | ||||
[JsonProperty("locale")] | |||||
public Optional<string> UserLocale { get; set; } | |||||
[JsonProperty("guild_locale")] | |||||
public Optional<string> GuildLocale { get; set; } | |||||
} | } | ||||
} | } |
@@ -33,6 +33,12 @@ namespace Discord.Rest | |||||
public RestUser User { get; private set; } | public RestUser User { get; private set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string UserLocale { get; private set; } | |||||
/// <inheritdoc/> | |||||
public string GuildLocale { get; private set; } | |||||
/// <inheritdoc/> | |||||
public DateTimeOffset CreatedAt { get; private set; } | public DateTimeOffset CreatedAt { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
@@ -126,6 +132,13 @@ namespace Discord.Rest | |||||
{ | { | ||||
Channel = (IRestMessageChannel)await discord.GetChannelAsync(model.ChannelId.Value); | Channel = (IRestMessageChannel)await discord.GetChannelAsync(model.ChannelId.Value); | ||||
} | } | ||||
UserLocale = model.UserLocale.IsSpecified | |||||
? model.UserLocale.Value | |||||
: null; | |||||
GuildLocale = model.GuildLocale.IsSpecified | |||||
? model.GuildLocale.Value | |||||
: null; | |||||
} | } | ||||
internal string SerializePayload(object payload) | internal string SerializePayload(object payload) | ||||
@@ -39,6 +39,12 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
public IDiscordInteractionData Data { get; private set; } | public IDiscordInteractionData Data { get; private set; } | ||||
/// <inheritdoc/> | |||||
public string UserLocale { get; private set; } | |||||
/// <inheritdoc/> | |||||
public string GuildLocale { get; private set; } | |||||
/// <summary> | /// <summary> | ||||
/// The version of this interaction. | /// The version of this interaction. | ||||
/// </summary> | /// </summary> | ||||
@@ -121,6 +127,13 @@ namespace Discord.WebSocket | |||||
User = SocketGlobalUser.Create(Discord, Discord.State, model.User.Value); | User = SocketGlobalUser.Create(Discord, Discord.State, model.User.Value); | ||||
} | } | ||||
} | } | ||||
UserLocale = model.UserLocale.IsSpecified | |||||
? model.UserLocale.Value | |||||
: null; | |||||
GuildLocale = model.GuildLocale.IsSpecified | |||||
? model.GuildLocale.Value | |||||
: null; | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||