Browse Source

Added missing files

tags/docs-0.9
RogueException 9 years ago
parent
commit
da75cebff2
3 changed files with 25 additions and 86 deletions
  1. +0
    -86
      src/Discord.Net/API/Voice.cs
  2. +17
    -0
      src/Discord.Net/Helpers/Shared/EventHelper.cs
  3. +8
    -0
      src/Discord.Net/LogExtensions.cs

+ 0
- 86
src/Discord.Net/API/Voice.cs View File

@@ -53,90 +53,4 @@ namespace Discord.API
[JsonProperty("token")]
public string Token;
}

//Commands (Voice)
internal sealed class VoiceLoginCommand : WebSocketMessage<VoiceLoginCommand.Data>
{
public VoiceLoginCommand() : base(0) { }
public class Data
{
[JsonProperty("server_id")]
[JsonConverter(typeof(LongStringConverter))]
public long ServerId;
[JsonProperty("user_id")]
[JsonConverter(typeof(LongStringConverter))]
public long UserId;
[JsonProperty("session_id")]
public string SessionId;
[JsonProperty("token")]
public string Token;
}
}
internal sealed class VoiceLogin2Command : WebSocketMessage<VoiceLogin2Command.Data>
{
public VoiceLogin2Command() : base(1) { }
public class Data
{
public class SocketInfo
{
[JsonProperty("address")]
public string Address;
[JsonProperty("port")]
public int Port;
[JsonProperty("mode")]
public string Mode = "xsalsa20_poly1305";
}
[JsonProperty("protocol")]
public string Protocol = "udp";
[JsonProperty("data")]
public SocketInfo SocketData = new SocketInfo();
}
}
internal sealed class VoiceKeepAliveCommand : WebSocketMessage<long>
{
public VoiceKeepAliveCommand() : base(3, EpochTime.GetMilliseconds()) { }
}
internal sealed class IsTalkingCommand : WebSocketMessage<IsTalkingCommand.Data>
{
public IsTalkingCommand() : base(5) { }
public class Data
{
[JsonProperty("delay")]
public int Delay;
[JsonProperty("speaking")]
public bool IsSpeaking;
}
}

//Events (Voice)
public class VoiceReadyEvent
{
[JsonProperty("ssrc")]
public uint SSRC;
[JsonProperty("port")]
public ushort Port;
[JsonProperty("modes")]
public string[] Modes;
[JsonProperty("heartbeat_interval")]
public int HeartbeatInterval;
}

public class JoinServerEvent
{
[JsonProperty("secret_key")]
public byte[] SecretKey;
[JsonProperty("mode")]
public string Mode;
}

public class IsTalkingEvent
{
[JsonProperty("user_id")]
[JsonConverter(typeof(LongStringConverter))]
public long UserId;
[JsonProperty("ssrc")]
public uint SSRC;
[JsonProperty("speaking")]
public bool IsSpeaking;
}
}

+ 17
- 0
src/Discord.Net/Helpers/Shared/EventHelper.cs View File

@@ -0,0 +1,17 @@
using System;

namespace Discord
{
public static class EventHelper
{
public static void Raise(Logger logger, string name, Action action)
{
try { action(); }
catch (Exception ex)
{
var ex2 = ex.GetBaseException();
logger.Log(LogSeverity.Error, $"{name}'s handler raised {ex2.GetType().Name}: ${ex2.Message}", ex);
}
}
}
}

+ 8
- 0
src/Discord.Net/LogExtensions.cs View File

@@ -0,0 +1,8 @@
namespace Discord
{
public static class LogExtensions
{
public static LogService Log(this DiscordClient client, bool required = true)
=> client.GetService<LogService>(required);
}
}

Loading…
Cancel
Save