Skip to content

Commit

Permalink
Try to parse DM group chat names instead of only using participants
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
Tyrrrz committed Apr 8, 2018
1 parent 7b67cbc commit de763f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions DiscordChatExporter.Core/Services/DataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ private Channel ParseChannel(JToken token)
if (type.IsEither(ChannelType.DirectTextChat, ChannelType.DirectGroupTextChat))
{
guildId = Guild.DirectMessages.Id;
var recipients = token["recipients"].Select(ParseUser);
name = recipients.Select(r => r.Name).JoinToString(", ");

// Try to get name if it's set
name = token["name"]?.Value<string>();

// Otherwise use recipients as the name
if (name.IsBlank())
name = token["recipients"].Select(ParseUser).Select(u => u.Name).JoinToString(", ");
}
else
{
Expand Down

0 comments on commit de763f8

Please sign in to comment.