diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
index 416655108..6bdff7b68 100644
--- a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
+++ b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
@@ -52,19 +52,37 @@ namespace Discord.Rest
public bool IsValidToken
=> InteractionHelper.CanRespondOrFollowup(this);
+ ///
+ /// Gets the ID of the channel this interaction was executed in.
+ ///
+ ///
+ /// if the interaction was not executed in a guild.
+ ///
+ public ulong? ChannelId { get; private set; } = null;
+
///
/// Gets the channel that this interaction was executed in.
///
///
- /// if is set to false.
+ /// if is set to false
+ /// or if the interaction was not executed in a guild.
///
public IRestMessageChannel Channel { get; private set; }
+ ///
+ /// Gets the ID of the guild this interaction was executed in if applicable.
+ ///
+ ///
+ /// if the interaction was not executed in a guild.
+ ///
+ public ulong? GuildId { get; private set; } = null;
+
///
/// Gets the guild this interaction was executed in if applicable.
///
///
- /// if is set to false.
+ /// This property will be if is set to false
+ /// or if the interaction was not executed in a guild.
///
public RestGuild Guild { get; private set; }
@@ -130,8 +148,9 @@ namespace Discord.Rest
Version = model.Version;
Type = model.Type;
- if(Guild == null && model.GuildId.IsSpecified)
+ if (Guild == null && model.GuildId.IsSpecified)
{
+ GuildId = model.GuildId.Value;
if (discord.APIOnInteractionCreation)
Guild = await discord.GetGuildAsync(model.GuildId.Value);
else
@@ -150,21 +169,23 @@ namespace Discord.Rest
}
}
- if(Channel == null && model.ChannelId.IsSpecified)
+ if (Channel == null && model.ChannelId.IsSpecified)
{
try
{
+ ChannelId = model.ChannelId.Value;
if (discord.APIOnInteractionCreation)
Channel = (IRestMessageChannel)await discord.GetChannelAsync(model.ChannelId.Value);
else
Channel = null;
}
- catch(HttpException x) when(x.DiscordCode == DiscordErrorCode.MissingPermissions) { } // ignore
+ catch (HttpException x) when (x.DiscordCode == DiscordErrorCode.MissingPermissions) { } // ignore
}
UserLocale = model.UserLocale.IsSpecified
- ? model.UserLocale.Value
- : null;
+ ? model.UserLocale.Value
+ : null;
+
GuildLocale = model.GuildLocale.IsSpecified
? model.GuildLocale.Value
: null;
@@ -180,6 +201,9 @@ namespace Discord.Rest
return json.ToString();
}
+ public async Task GetGuildAsync()
+ => await
+
///
public abstract string Defer(bool ephemeral = false, RequestOptions options = null);
///