Added missing files

This commit is contained in:
RogueException
2015-12-05 05:33:21 -04:00
parent 74c0bb5b51
commit da75cebff2
3 changed files with 25 additions and 86 deletions

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;
}
}

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);
}
}
}
}

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);
}
}