@@ -1,13 +1,11 @@
using Discord.API;
using Discord.API;
using Discord.API.Models;
using Discord.API.Models;
using Discord.Helpers;
using Discord.Helpers;
using Discord.Models;
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Role = Discord.Models.Role;
namespace Discord
namespace Discord
{
{
@@ -372,7 +370,7 @@ namespace Discord
var extendedModel = model as ExtendedServerInfo;
var extendedModel = model as ExtendedServerInfo;
server.AFKChannelId = extendedModel.AFKChannelId;
server.AFKChannelId = extendedModel.AFKChannelId;
server.AFKTimeout = extendedModel.AFKTimeout;
server.AFKTimeout = extendedModel.AFKTimeout;
server.JoinedAt = extendedModel.JoinedAt;
server.JoinedAt = extendedModel.JoinedAt ?? DateTime.MinValue ;
server.OwnerId = extendedModel.OwnerId;
server.OwnerId = extendedModel.OwnerId;
server.Presence = extendedModel.Presence;
server.Presence = extendedModel.Presence;
server.Region = extendedModel.Region;
server.Region = extendedModel.Region;
@@ -420,7 +418,7 @@ namespace Discord
private Channel DeleteChannel(string id)
private Channel DeleteChannel(string id)
{
{
Channel channel = null;
Channel channel = null;
if (_channels.TryRemove(id, out channel))
if (_channels.TryRemove(id, out channel) && !channel.IsPrivate )
{
{
bool ignored;
bool ignored;
channel.Server._channels.TryRemove(id, out ignored);
channel.Server._channels.TryRemove(id, out ignored);
@@ -429,10 +427,10 @@ namespace Discord
}
}
//TODO: Temporary measure, unsure if we want to store these or not.
//TODO: Temporary measure, unsure if we want to store these or not.
private ChatMessageReference GetMessage(string id, string channelId)
private ChatMessage GetMessage(string id, string channelId)
{
{
if (id == null || channelId == null) return null;
if (id == null || channelId == null) return null;
return new ChatMessageReference (id, channelId, this);
return new ChatMessage(id, channelId, this);
}
}
private ChatMessage UpdateMessage(WebSocketEvents.MessageCreate model, bool addNew = true)
private ChatMessage UpdateMessage(WebSocketEvents.MessageCreate model, bool addNew = true)
{
{