mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-24 06:54:44 +00:00
Refactor string checks and fix exception when exporting multiple channels
Fix #164
This commit is contained in:
@@ -41,14 +41,14 @@ namespace DiscordChatExporter.Core.Services
|
||||
var guildId = json["guild_id"]?.Value<string>();
|
||||
|
||||
// If the guild ID is blank, it's direct messages
|
||||
if (guildId == null)
|
||||
if (guildId.IsNullOrWhiteSpace())
|
||||
guildId = Guild.DirectMessages.Id;
|
||||
|
||||
// Try to extract name
|
||||
var name = json["name"]?.Value<string>();
|
||||
|
||||
// If the name is blank, it's direct messages
|
||||
if (name == null)
|
||||
if (name.IsNullOrWhiteSpace())
|
||||
name = json["recipients"].Select(ParseUser).Select(u => u.Name).JoinToString(", ");
|
||||
|
||||
return new Channel(id, parentId, guildId, name, topic, type);
|
||||
|
||||
Reference in New Issue
Block a user