Group channels by category in GUI

Closes #77
This commit is contained in:
Oleksii Holub
2019-01-30 18:16:46 +02:00
parent ba5790e312
commit b3e2dd3994
10 changed files with 130 additions and 41 deletions

View File

@@ -6,6 +6,8 @@
{
public string Id { get; }
public string ParentId { get; }
public string GuildId { get; }
public string Name { get; }
@@ -13,10 +15,11 @@
public string Topic { get; }
public ChannelType Type { get; }
public Channel(string id, string guildId, string name, string topic, ChannelType type)
public Channel(string id, string parentId, string guildId, string name, string topic, ChannelType type)
{
Id = id;
ParentId = parentId;
GuildId = guildId;
Name = name;
Topic = topic;
@@ -29,6 +32,6 @@
public partial class Channel
{
public static Channel CreateDeletedChannel(string id) =>
new Channel(id, null, "deleted-channel", null, ChannelType.GuildTextChat);
new Channel(id, null, null, "deleted-channel", null, ChannelType.GuildTextChat);
}
}

View File

@@ -33,6 +33,7 @@ namespace DiscordChatExporter.Core.Services
{
// Get basic data
var id = json["id"].Value<string>();
var parentId = json["parent_id"]?.Value<string>();
var type = (ChannelType) json["type"].Value<int>();
var topic = json["topic"]?.Value<string>();
@@ -50,7 +51,7 @@ namespace DiscordChatExporter.Core.Services
if (name.IsBlank())
name = json["recipients"].Select(ParseUser).Select(u => u.Name).JoinToString(", ");
return new Channel(id, guildId, name, topic, type);
return new Channel(id, parentId, guildId, name, topic, type);
}
private Role ParseRole(JToken json)