Skip to content

Commit

Permalink
made VoiceStateUpdate#ChannelID nullable since it can be null in Voic…
Browse files Browse the repository at this point in the history
…eStateUpdates and adapeted that change in D.Net example
  • Loading branch information
DevYukine committed Jun 27, 2018
1 parent 06645f0 commit 70512d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Lavalink.NET/Types/DiscordOP4Packet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class DiscordOP4Packet
/// </summary>
[JsonProperty("op")]
public int OPCode { get; set; } = 4;

/// <summary>
/// The DiscordVoicePacket to send to the Discord Websocket Gateway.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Lavalink.NET/Types/PlayerPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public class VoiceStateUpdate
/// The ChannelID of the update as ulong.
/// </summary>
[JsonIgnore]
public ulong ChannelID { get; set; }
public ulong? ChannelID { get; set; }

/// <summary>
/// The ChannelID of the update as String.
/// </summary>
[JsonProperty("channel_id")]
public string ChannelIDString => ChannelID.ToString();
public string ChannelIDString => ChannelID?.ToString();

/// <summary>
/// The User ID of the update as ulong.
Expand Down
2 changes: 1 addition & 1 deletion Testbot_Discord.Net/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task MainAsync()
private async Task VoiceStateUpdate(SocketUser user, SocketVoiceState before, SocketVoiceState after)
{
await _lavalinkClient.VoiceStateUpdateAsync(new VoiceStateUpdate {
ChannelID = after.VoiceChannel?.Id ?? before.VoiceChannel.Id,
ChannelID = after.VoiceChannel?.Id,
GuildID = after.VoiceChannel?.Guild.Id ?? before.VoiceChannel.Guild.Id,
SessionID = after.VoiceSessionId,
UserID = user.Id,
Expand Down

0 comments on commit 70512d3

Please sign in to comment.