mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-14 19:02:30 +00:00
Refactor string checks and fix exception when exporting multiple channels
Fix #164
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.0" />
|
||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -40,7 +40,7 @@ namespace DiscordChatExporter.Core.Models
|
||||
public static string GetImageUrl(string id, string name, bool isAnimated)
|
||||
{
|
||||
// Custom emoji
|
||||
if (id != null)
|
||||
if (!id.IsNullOrWhiteSpace())
|
||||
{
|
||||
// Animated
|
||||
if (isAnimated)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace DiscordChatExporter.Core.Models
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Models
|
||||
{
|
||||
// https://discordapp.com/developers/docs/resources/guild#guild-object
|
||||
|
||||
@@ -28,7 +30,7 @@
|
||||
{
|
||||
public static string GetIconUrl(string id, string iconHash)
|
||||
{
|
||||
return iconHash != null
|
||||
return !iconHash.IsNullOrWhiteSpace()
|
||||
? $"https://cdn.discordapp.com/icons/{id}/{iconHash}.png"
|
||||
: "https://cdn.discordapp.com/embed/avatars/0.png";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Models
|
||||
{
|
||||
@@ -39,7 +40,7 @@ namespace DiscordChatExporter.Core.Models
|
||||
public static string GetAvatarUrl(string id, int discriminator, string avatarHash)
|
||||
{
|
||||
// Custom avatar
|
||||
if (avatarHash != null)
|
||||
if (!avatarHash.IsNullOrWhiteSpace())
|
||||
{
|
||||
// Animated
|
||||
if (avatarHash.StartsWith("a_", StringComparison.Ordinal))
|
||||
|
||||
Reference in New Issue
Block a user