Made API models internal. Removed Discord.Net.API.
This commit is contained in:
11
src/Discord.Net.Rpc/API/Rpc/AuthenticateParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/AuthenticateParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class AuthenticateParams
|
||||
{
|
||||
[JsonProperty("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/Discord.Net.Rpc/API/Rpc/AuthenticateResponse.cs
Normal file
18
src/Discord.Net.Rpc/API/Rpc/AuthenticateResponse.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class AuthenticateResponse
|
||||
{
|
||||
[JsonProperty("application")]
|
||||
public Application Application { get; set; }
|
||||
[JsonProperty("expires")]
|
||||
public DateTimeOffset Expires { get; set; }
|
||||
[JsonProperty("user")]
|
||||
public User User { get; set; }
|
||||
[JsonProperty("scopes")]
|
||||
public string[] Scopes { get; set; }
|
||||
}
|
||||
}
|
||||
16
src/Discord.Net.Rpc/API/Rpc/AuthorizeParams.cs
Normal file
16
src/Discord.Net.Rpc/API/Rpc/AuthorizeParams.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class AuthorizeParams
|
||||
{
|
||||
[JsonProperty("client_id")]
|
||||
public string ClientId { get; set; }
|
||||
[JsonProperty("scopes")]
|
||||
public IReadOnlyCollection<string> Scopes { get; set; }
|
||||
[JsonProperty("rpc_token")]
|
||||
public Optional<string> RpcToken { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/AuthorizeResponse.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/AuthorizeResponse.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class AuthorizeResponse
|
||||
{
|
||||
[JsonProperty("code")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
34
src/Discord.Net.Rpc/API/Rpc/Channel.cs
Normal file
34
src/Discord.Net.Rpc/API/Rpc/Channel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class Channel
|
||||
{
|
||||
//Shared
|
||||
[JsonProperty("id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonProperty("type")]
|
||||
public ChannelType Type { get; set; }
|
||||
|
||||
//GuildChannel
|
||||
[JsonProperty("guild_id")]
|
||||
public Optional<ulong> GuildId { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public Optional<string> Name { get; set; }
|
||||
[JsonProperty("position")]
|
||||
public Optional<int> Position { get; set; }
|
||||
|
||||
//IMessageChannel
|
||||
[JsonProperty("messages")]
|
||||
public Message[] Messages { get; set; }
|
||||
|
||||
//VoiceChannel
|
||||
[JsonProperty("bitrate")]
|
||||
public Optional<int> Bitrate { get; set; }
|
||||
[JsonProperty("user_limit")]
|
||||
public Optional<int> UserLimit { get; set; }
|
||||
[JsonProperty("voice_states")]
|
||||
public ExtendedVoiceState[] VoiceStates { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/ChannelSubscriptionParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/ChannelSubscriptionParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class ChannelSubscriptionParams
|
||||
{
|
||||
[JsonProperty("channel_id")]
|
||||
public ulong ChannelId { get; set; }
|
||||
}
|
||||
}
|
||||
14
src/Discord.Net.Rpc/API/Rpc/ChannelSummary.cs
Normal file
14
src/Discord.Net.Rpc/API/Rpc/ChannelSummary.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class ChannelSummary
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("type")]
|
||||
public ChannelType Type { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Rpc/API/Rpc/ErrorEvent.cs
Normal file
13
src/Discord.Net.Rpc/API/Rpc/ErrorEvent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class ErrorEvent
|
||||
{
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; }
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Discord.Net.Rpc/API/Rpc/ExtendedVoiceState.cs
Normal file
21
src/Discord.Net.Rpc/API/Rpc/ExtendedVoiceState.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class ExtendedVoiceState
|
||||
{
|
||||
[JsonProperty("user")]
|
||||
public User User { get; set; }
|
||||
[JsonProperty("voice_state")]
|
||||
public Optional<VoiceState> VoiceState { get; set; }
|
||||
[JsonProperty("nick")]
|
||||
public Optional<string> Nickname { get; set; }
|
||||
[JsonProperty("volume")]
|
||||
public Optional<int> Volume { get; set; }
|
||||
[JsonProperty("mute")]
|
||||
public Optional<bool> Mute { get; set; }
|
||||
[JsonProperty("pan")]
|
||||
public Optional<Pan> Pan { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/GetChannelParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/GetChannelParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetChannelParams
|
||||
{
|
||||
[JsonProperty("channel_id")]
|
||||
public ulong ChannelId { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/GetChannelsParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/GetChannelsParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetChannelsParams
|
||||
{
|
||||
[JsonProperty("guild_id")]
|
||||
public ulong GuildId { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Discord.Net.Rpc/API/Rpc/GetChannelsResponse.cs
Normal file
12
src/Discord.Net.Rpc/API/Rpc/GetChannelsResponse.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetChannelsResponse
|
||||
{
|
||||
[JsonProperty("channels")]
|
||||
public IReadOnlyCollection<ChannelSummary> Channels { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/GetGuildParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/GetGuildParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetGuildParams
|
||||
{
|
||||
[JsonProperty("guild_id")]
|
||||
public ulong GuildId { get; set; }
|
||||
}
|
||||
}
|
||||
8
src/Discord.Net.Rpc/API/Rpc/GetGuildsParams.cs
Normal file
8
src/Discord.Net.Rpc/API/Rpc/GetGuildsParams.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetGuildsParams
|
||||
{
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/GetGuildsResponse.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/GetGuildsResponse.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GetGuildsResponse
|
||||
{
|
||||
[JsonProperty("guilds")]
|
||||
public GuildSummary[] Guilds { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/Discord.Net.Rpc/API/Rpc/Guild.cs
Normal file
18
src/Discord.Net.Rpc/API/Rpc/Guild.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class Guild
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("icon_url")]
|
||||
public string IconUrl { get; set; }
|
||||
[JsonProperty("members")]
|
||||
public IEnumerable<GuildMember> Members { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Discord.Net.Rpc/API/Rpc/GuildMember.cs
Normal file
15
src/Discord.Net.Rpc/API/Rpc/GuildMember.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GuildMember
|
||||
{
|
||||
[JsonProperty("user")]
|
||||
public User User { get; set; }
|
||||
[JsonProperty("status")]
|
||||
public UserStatus Status { get; set; }
|
||||
/*[JsonProperty("activity")]
|
||||
public object Activity { get; set; }*/
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Rpc/API/Rpc/GuildStatusEvent.cs
Normal file
13
src/Discord.Net.Rpc/API/Rpc/GuildStatusEvent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GuildStatusEvent
|
||||
{
|
||||
[JsonProperty("guild")]
|
||||
public Guild Guild { get; set; }
|
||||
[JsonProperty("online")]
|
||||
public int Online { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/GuildSubscriptionParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/GuildSubscriptionParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GuildSubscriptionParams
|
||||
{
|
||||
[JsonProperty("guild_id")]
|
||||
public ulong GuildId { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Discord.Net.Rpc/API/Rpc/GuildSummary.cs
Normal file
12
src/Discord.Net.Rpc/API/Rpc/GuildSummary.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class GuildSummary
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
17
src/Discord.Net.Rpc/API/Rpc/Message.cs
Normal file
17
src/Discord.Net.Rpc/API/Rpc/Message.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class Message : Discord.API.Message
|
||||
{
|
||||
[JsonProperty("blocked")]
|
||||
public Optional<bool> IsBlocked { get; }
|
||||
[JsonProperty("content_parsed")]
|
||||
public Optional<object[]> ContentParsed { get; }
|
||||
[JsonProperty("author_color")]
|
||||
public Optional<string> AuthorColor { get; } //#Hex
|
||||
|
||||
[JsonProperty("mentions")]
|
||||
public new Optional<ulong[]> UserMentions { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Discord.Net.Rpc/API/Rpc/MessageEvent.cs
Normal file
12
src/Discord.Net.Rpc/API/Rpc/MessageEvent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class MessageEvent
|
||||
{
|
||||
[JsonProperty("channel_id")]
|
||||
public ulong ChannelId { get; set; }
|
||||
[JsonProperty("message")]
|
||||
public Message Message { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Discord.Net.Rpc/API/Rpc/Pan.cs
Normal file
12
src/Discord.Net.Rpc/API/Rpc/Pan.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class Pan
|
||||
{
|
||||
[JsonProperty("left")]
|
||||
public float Left { get; set; }
|
||||
[JsonProperty("right")]
|
||||
public float Right { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Rpc/API/Rpc/ReadyEvent.cs
Normal file
13
src/Discord.Net.Rpc/API/Rpc/ReadyEvent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class ReadyEvent
|
||||
{
|
||||
[JsonProperty("v")]
|
||||
public int Version { get; set; }
|
||||
[JsonProperty("config")]
|
||||
public RpcConfig Config { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Discord.Net.Rpc/API/Rpc/RpcConfig.cs
Normal file
15
src/Discord.Net.Rpc/API/Rpc/RpcConfig.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class RpcConfig
|
||||
{
|
||||
[JsonProperty("cdn_host")]
|
||||
public string CdnHost { get; set; }
|
||||
[JsonProperty("api_endpoint")]
|
||||
public string ApiEndpoint { get; set; }
|
||||
[JsonProperty("environment")]
|
||||
public string Environment { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Rpc/API/Rpc/SelectChannelParams.cs
Normal file
13
src/Discord.Net.Rpc/API/Rpc/SelectChannelParams.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class SelectChannelParams
|
||||
{
|
||||
[JsonProperty("channel_id")]
|
||||
public ulong? ChannelId { get; set; }
|
||||
[JsonProperty("force")]
|
||||
public Optional<bool> Force { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/SetLocalVolumeParams.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/SetLocalVolumeParams.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class SetLocalVolumeParams
|
||||
{
|
||||
[JsonProperty("volume")]
|
||||
public int Volume { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Rpc/API/Rpc/SetLocalVolumeResponse.cs
Normal file
13
src/Discord.Net.Rpc/API/Rpc/SetLocalVolumeResponse.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class SetLocalVolumeResponse
|
||||
{
|
||||
[JsonProperty("user_id")]
|
||||
public ulong UserId { get; set; }
|
||||
[JsonProperty("volume")]
|
||||
public int Volume { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/SpeakingEvent.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/SpeakingEvent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class SpeakingEvent
|
||||
{
|
||||
[JsonProperty("user_id")]
|
||||
public ulong UserId { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/API/Rpc/SubscriptionResponse.cs
Normal file
11
src/Discord.Net.Rpc/API/Rpc/SubscriptionResponse.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class SubscriptionResponse
|
||||
{
|
||||
[JsonProperty("evt")]
|
||||
public string Event { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/Discord.Net.Rpc/API/Rpc/UserVoiceSettings.cs
Normal file
18
src/Discord.Net.Rpc/API/Rpc/UserVoiceSettings.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class UserVoiceSettings
|
||||
{
|
||||
[JsonProperty("userId")]
|
||||
internal ulong UserId { get; set; }
|
||||
[JsonProperty("pan")]
|
||||
public Optional<Pan> Pan { get; set; }
|
||||
[JsonProperty("volume")]
|
||||
public Optional<int> Volume { get; set; }
|
||||
[JsonProperty("mute")]
|
||||
public Optional<bool> Mute { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Discord.Net.Rpc/API/Rpc/VoiceDevice.cs
Normal file
12
src/Discord.Net.Rpc/API/Rpc/VoiceDevice.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class VoiceDevice
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
14
src/Discord.Net.Rpc/API/Rpc/VoiceDeviceSettings.cs
Normal file
14
src/Discord.Net.Rpc/API/Rpc/VoiceDeviceSettings.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class VoiceDeviceSettings
|
||||
{
|
||||
[JsonProperty("device_id")]
|
||||
public Optional<string> DeviceId { get; set; }
|
||||
[JsonProperty("volume")]
|
||||
public Optional<float> Volume { get; set; }
|
||||
[JsonProperty("available_devices")]
|
||||
public Optional<VoiceDevice[]> AvailableDevices { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/Discord.Net.Rpc/API/Rpc/VoiceMode.cs
Normal file
18
src/Discord.Net.Rpc/API/Rpc/VoiceMode.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class VoiceMode
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public Optional<string> Type { get; set; }
|
||||
[JsonProperty("auto_threshold")]
|
||||
public Optional<bool> AutoThreshold { get; set; }
|
||||
[JsonProperty("threshold")]
|
||||
public Optional<float> Threshold { get; set; }
|
||||
[JsonProperty("shortcut")]
|
||||
public Optional<VoiceShortcut[]> Shortcut { get; set; }
|
||||
[JsonProperty("delay")]
|
||||
public Optional<float> Delay { get; set; }
|
||||
}
|
||||
}
|
||||
26
src/Discord.Net.Rpc/API/Rpc/VoiceSettings.cs
Normal file
26
src/Discord.Net.Rpc/API/Rpc/VoiceSettings.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class VoiceSettings
|
||||
{
|
||||
[JsonProperty("input")]
|
||||
public VoiceDeviceSettings Input { get; set; }
|
||||
[JsonProperty("output")]
|
||||
public VoiceDeviceSettings Output { get; set; }
|
||||
[JsonProperty("mode")]
|
||||
public VoiceMode Mode { get; set; }
|
||||
[JsonProperty("automatic_gain_control")]
|
||||
public Optional<bool> AutomaticGainControl { get; set; }
|
||||
[JsonProperty("echo_cancellation")]
|
||||
public Optional<bool> EchoCancellation { get; set; }
|
||||
[JsonProperty("noise_suppression")]
|
||||
public Optional<bool> NoiseSuppression { get; set; }
|
||||
[JsonProperty("qos")]
|
||||
public Optional<bool> QualityOfService { get; set; }
|
||||
[JsonProperty("silence_warning")]
|
||||
public Optional<bool> SilenceWarning { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Discord.Net.Rpc/API/Rpc/VoiceShortcut.cs
Normal file
15
src/Discord.Net.Rpc/API/Rpc/VoiceShortcut.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Discord.Rpc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class VoiceShortcut
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public Optional<VoiceShortcutType> Type { get; set; }
|
||||
[JsonProperty("code")]
|
||||
public Optional<int> Code { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public Optional<string> Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Discord.Net.API\Discord.Net.API.csproj" />
|
||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" />
|
||||
<ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
public class DiscordRpcApiClient : DiscordRestApiClient, IDisposable
|
||||
internal class DiscordRpcApiClient : DiscordRestApiClient, IDisposable
|
||||
{
|
||||
private abstract class RpcRequest
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Discord.API.Rpc;
|
||||
using Discord.Logging;
|
||||
using Discord.Net.Converters;
|
||||
using Discord.Net.Queue;
|
||||
using Discord.Rest;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -31,7 +30,7 @@ namespace Discord.Rpc
|
||||
//From DiscordRpcConfig
|
||||
internal int ConnectionTimeout { get; private set; }
|
||||
|
||||
public new API.DiscordRpcApiClient ApiClient => base.ApiClient as API.DiscordRpcApiClient;
|
||||
internal new API.DiscordRpcApiClient ApiClient => base.ApiClient as API.DiscordRpcApiClient;
|
||||
public new RestSelfUser CurrentUser { get { return base.CurrentUser as RestSelfUser; } private set { base.CurrentUser = value; } }
|
||||
public RestApplication ApplicationInfo { get; private set; }
|
||||
|
||||
@@ -308,20 +307,67 @@ namespace Discord.Rpc
|
||||
var model = await ApiClient.GetVoiceSettingsAsync(options).ConfigureAwait(false);
|
||||
return VoiceSettings.Create(model);
|
||||
}
|
||||
public async Task SetVoiceSettingsAsync(Action<API.Rpc.VoiceSettings> func, RequestOptions options = null)
|
||||
public async Task SetVoiceSettingsAsync(Action<VoiceProperties> func, RequestOptions options = null)
|
||||
{
|
||||
var settings = new API.Rpc.VoiceSettings();
|
||||
settings.Input = new VoiceDeviceSettings();
|
||||
settings.Output = new VoiceDeviceSettings();
|
||||
settings.Mode = new VoiceMode();
|
||||
if (func == null) throw new NullReferenceException(nameof(func));
|
||||
|
||||
var settings = new VoiceProperties();
|
||||
settings.Input = new VoiceDeviceProperties();
|
||||
settings.Output = new VoiceDeviceProperties();
|
||||
settings.Mode = new VoiceModeProperties();
|
||||
func(settings);
|
||||
await ApiClient.SetVoiceSettingsAsync(settings, options).ConfigureAwait(false);
|
||||
|
||||
var model = new API.Rpc.VoiceSettings
|
||||
{
|
||||
AutomaticGainControl = settings.AutomaticGainControl,
|
||||
EchoCancellation = settings.EchoCancellation,
|
||||
NoiseSuppression = settings.NoiseSuppression,
|
||||
QualityOfService = settings.QualityOfService,
|
||||
SilenceWarning = settings.SilenceWarning
|
||||
};
|
||||
model.Input = new API.Rpc.VoiceDeviceSettings
|
||||
{
|
||||
DeviceId = settings.Input.DeviceId,
|
||||
Volume = settings.Input.Volume
|
||||
};
|
||||
model.Output = new API.Rpc.VoiceDeviceSettings
|
||||
{
|
||||
DeviceId = settings.Output.DeviceId,
|
||||
Volume = settings.Output.Volume
|
||||
};
|
||||
model.Mode = new API.Rpc.VoiceMode
|
||||
{
|
||||
AutoThreshold = settings.Mode.AutoThreshold,
|
||||
Delay = settings.Mode.Delay,
|
||||
Threshold = settings.Mode.Threshold,
|
||||
Type = settings.Mode.Type
|
||||
};
|
||||
|
||||
if (settings.Input.AvailableDevices.IsSpecified)
|
||||
model.Input.AvailableDevices = settings.Input.AvailableDevices.Value.Select(x => x.ToModel()).ToArray();
|
||||
if (settings.Output.AvailableDevices.IsSpecified)
|
||||
model.Output.AvailableDevices = settings.Output.AvailableDevices.Value.Select(x => x.ToModel()).ToArray();
|
||||
if (settings.Mode.Shortcut.IsSpecified)
|
||||
model.Mode.Shortcut = settings.Mode.Shortcut.Value.Select(x => x.ToModel()).ToArray();
|
||||
|
||||
await ApiClient.SetVoiceSettingsAsync(model, options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task SetUserVoiceSettingsAsync(ulong userId, Action<API.Rpc.UserVoiceSettings> func, RequestOptions options = null)
|
||||
public async Task SetUserVoiceSettingsAsync(ulong userId, Action<UserVoiceProperties> func, RequestOptions options = null)
|
||||
{
|
||||
var settings = new API.Rpc.UserVoiceSettings();
|
||||
if (func == null) throw new NullReferenceException(nameof(func));
|
||||
|
||||
var settings = new UserVoiceProperties();
|
||||
func(settings);
|
||||
await ApiClient.SetUserVoiceSettingsAsync(userId, settings, options).ConfigureAwait(false);
|
||||
|
||||
var model = new API.Rpc.UserVoiceSettings
|
||||
{
|
||||
Mute = settings.Mute,
|
||||
UserId = settings.UserId,
|
||||
Volume = settings.Volume
|
||||
};
|
||||
if (settings.Pan.IsSpecified)
|
||||
model.Pan = settings.Pan.Value.ToModel();
|
||||
await ApiClient.SetUserVoiceSettingsAsync(userId, model, options).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static string GetEventName(RpcGlobalEvent rpcEvent)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Discord.Rpc
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
|
||||
#if NETSTANDARD1_3
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
|
||||
@@ -108,7 +108,7 @@ namespace Discord.Rpc
|
||||
#endif
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Discord.Rpc
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
|
||||
#if NETSTANDARD1_3
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
|
||||
@@ -107,7 +107,7 @@ namespace Discord.Rpc
|
||||
#endif
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Discord.Rpc
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
|
||||
#if NETSTANDARD1_3
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
|
||||
@@ -109,7 +109,7 @@ namespace Discord.Rpc
|
||||
#endif
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Discord.Rpc
|
||||
{
|
||||
var embeds = ImmutableArray.CreateBuilder<Embed>(value.Length);
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
embeds.Add(Embed.Create(value[i]));
|
||||
embeds.Add(value[i].ToEntity());
|
||||
_embeds = embeds.ToImmutable();
|
||||
}
|
||||
else
|
||||
|
||||
18
src/Discord.Net.Rpc/Entities/UserVoiceProperties.cs
Normal file
18
src/Discord.Net.Rpc/Entities/UserVoiceProperties.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
public class UserVoiceProperties
|
||||
{
|
||||
[JsonProperty("userId")]
|
||||
internal ulong UserId { get; set; }
|
||||
[JsonProperty("pan")]
|
||||
public Optional<Pan> Pan { get; set; }
|
||||
[JsonProperty("volume")]
|
||||
public Optional<int> Volume { get; set; }
|
||||
[JsonProperty("mute")]
|
||||
public Optional<bool> Mute { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace Discord.Rpc
|
||||
=> UserHelper.CreateDMChannelAsync(this, Discord, options);
|
||||
|
||||
public override string ToString() => $"{Username}#{Discriminator}";
|
||||
internal string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
|
||||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
|
||||
|
||||
//IUser
|
||||
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Discord.Rpc
|
||||
}
|
||||
|
||||
public override string ToString() => User.ToString();
|
||||
internal string DebuggerDisplay => $"{User} ({_voiceStates})";
|
||||
private string DebuggerDisplay => $"{User} ({_voiceStates})";
|
||||
|
||||
string IVoiceState.VoiceSessionId { get { throw new NotSupportedException(); } }
|
||||
IVoiceChannel IVoiceState.VoiceChannel { get { throw new NotSupportedException(); } }
|
||||
|
||||
10
src/Discord.Net.Rpc/Entities/Users/UserVoiceProperties.cs
Normal file
10
src/Discord.Net.Rpc/Entities/Users/UserVoiceProperties.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Discord.Rpc.Entities.Users
|
||||
{
|
||||
class UserVoiceProperties
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,6 @@ namespace Discord.Rpc
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Name}";
|
||||
internal string DebuggerDisplay => $"{Name} ({Id})";
|
||||
private string DebuggerDisplay => $"{Name} ({Id})";
|
||||
}
|
||||
}
|
||||
|
||||
9
src/Discord.Net.Rpc/Entities/VoiceDeviceProperties.cs
Normal file
9
src/Discord.Net.Rpc/Entities/VoiceDeviceProperties.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
public class VoiceDeviceProperties
|
||||
{
|
||||
public Optional<string> DeviceId { get; set; }
|
||||
public Optional<float> Volume { get; set; }
|
||||
public Optional<VoiceDevice[]> AvailableDevices { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Discord.Net.Rpc/Entities/VoiceModeProperties.cs
Normal file
11
src/Discord.Net.Rpc/Entities/VoiceModeProperties.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
public class VoiceModeProperties
|
||||
{
|
||||
public Optional<string> Type { get; set; }
|
||||
public Optional<bool> AutoThreshold { get; set; }
|
||||
public Optional<float> Threshold { get; set; }
|
||||
public Optional<VoiceShortcut[]> Shortcut { get; set; }
|
||||
public Optional<float> Delay { get; set; }
|
||||
}
|
||||
}
|
||||
14
src/Discord.Net.Rpc/Entities/VoiceProperties.cs
Normal file
14
src/Discord.Net.Rpc/Entities/VoiceProperties.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
public class VoiceProperties
|
||||
{
|
||||
public VoiceDeviceProperties Input { get; set; }
|
||||
public VoiceDeviceProperties Output { get; set; }
|
||||
public VoiceModeProperties Mode { get; set; }
|
||||
public Optional<bool> AutomaticGainControl { get; set; }
|
||||
public Optional<bool> EchoCancellation { get; set; }
|
||||
public Optional<bool> NoiseSuppression { get; set; }
|
||||
public Optional<bool> QualityOfService { get; set; }
|
||||
public Optional<bool> SilenceWarning { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,6 @@ namespace Discord.Rpc
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Name}";
|
||||
internal string DebuggerDisplay => $"{Name} ({Code}, {Type})";
|
||||
private string DebuggerDisplay => $"{Name} ({Code}, {Type})";
|
||||
}
|
||||
}
|
||||
|
||||
10
src/Discord.Net.Rpc/Entities/VoiceShortcutType.cs
Normal file
10
src/Discord.Net.Rpc/Entities/VoiceShortcutType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
public enum VoiceShortcutType
|
||||
{
|
||||
KeyboardKey = 0,
|
||||
MouseButton = 1,
|
||||
KeyboardModifierKey = 2,
|
||||
GamepadButton = 3
|
||||
}
|
||||
}
|
||||
31
src/Discord.Net.Rpc/Extensions/EntityExtensions.cs
Normal file
31
src/Discord.Net.Rpc/Extensions/EntityExtensions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace Discord.Rpc
|
||||
{
|
||||
internal static class EntityExtensions
|
||||
{
|
||||
public static API.Rpc.Pan ToModel(this Pan entity)
|
||||
{
|
||||
return new API.Rpc.Pan
|
||||
{
|
||||
Left = entity.Left,
|
||||
Right = entity.Right
|
||||
};
|
||||
}
|
||||
public static API.Rpc.VoiceDevice ToModel(this VoiceDevice entity)
|
||||
{
|
||||
return new API.Rpc.VoiceDevice
|
||||
{
|
||||
Id = entity.Id,
|
||||
Name = entity.Name
|
||||
};
|
||||
}
|
||||
public static API.Rpc.VoiceShortcut ToModel(this VoiceShortcut entity)
|
||||
{
|
||||
return new API.Rpc.VoiceShortcut
|
||||
{
|
||||
Code = entity.Code,
|
||||
Name = entity.Name,
|
||||
Type = entity.Type
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user