diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs
index e36353855..9bccae615 100644
--- a/src/Discord.Net.Rest/DiscordRestClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestClient.cs
@@ -24,6 +24,8 @@ namespace Discord.Rest
///
/// The configuration to be used with the client.
public DiscordRestClient(DiscordRestConfig config) : base(config, CreateApiClient(config)) { }
+ // used for socket client rest access
+ internal DiscordRestClient(DiscordRestConfig config, API.DiscordRestApiClient api) : base(config, api) { }
private static API.DiscordRestApiClient CreateApiClient(DiscordRestConfig config)
=> new API.DiscordRestApiClient(config.RestClientProvider, DiscordRestConfig.UserAgent);
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index 3d260d1a6..b68ba22ed 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -43,6 +43,8 @@ namespace Discord.WebSocket
private DateTimeOffset? _statusSince;
private RestApplication _applicationInfo;
+ /// Provides access to a REST-only client with a shared state from this client.
+ public DiscordSocketRestClient Rest { get; }
/// Gets the shard of of this client.
public int ShardId { get; }
/// Gets the current connection state of this client.
@@ -124,6 +126,7 @@ namespace Discord.WebSocket
AlwaysDownloadUsers = config.AlwaysDownloadUsers;
HandlerTimeout = config.HandlerTimeout;
State = new ClientState(0, 0);
+ Rest = new DiscordSocketRestClient(config, ApiClient);
_heartbeatTimes = new ConcurrentQueue();
_stateLock = new SemaphoreSlim(1, 1);
diff --git a/src/Discord.Net.WebSocket/DiscordSocketRestClient.cs b/src/Discord.Net.WebSocket/DiscordSocketRestClient.cs
new file mode 100644
index 000000000..2c9176d20
--- /dev/null
+++ b/src/Discord.Net.WebSocket/DiscordSocketRestClient.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Threading.Tasks;
+using Discord.Rest;
+
+namespace Discord.WebSocket
+{
+ public class DiscordSocketRestClient : DiscordRestClient
+ {
+ internal DiscordSocketRestClient(DiscordRestConfig config, API.DiscordRestApiClient api) : base(config, api) { }
+
+ public new Task LoginAsync(TokenType tokenType, string token, bool validateToken = true)
+ => throw new NotSupportedException("The Socket REST wrapper cannot be used to log in or out.");
+ public new Task LogoutAsync()
+ => throw new NotSupportedException("The Socket REST wrapper cannot be used to log in or out.");
+ }
+}