From 501c662906ffae7dc7310adc33e18d5c419830e0 Mon Sep 17 00:00:00 2001 From: yiyun Date: Tue, 10 May 2022 13:01:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugins/qqnoteplugin/):=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BD=BF=E7=94=A8=20Markdown=20=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/QQNotePlugin/QQNotePlugin.cs | 12 +++++++----- plugins/QQNotePlugin/info.json | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/QQNotePlugin/QQNotePlugin.cs b/plugins/QQNotePlugin/QQNotePlugin.cs index c0120d19a..f652a1463 100644 --- a/plugins/QQNotePlugin/QQNotePlugin.cs +++ b/plugins/QQNotePlugin/QQNotePlugin.cs @@ -138,12 +138,14 @@ public void OnFriendMessage((Bot s, FriendMessageEvent e) obj, string message, u #region 图片文件形式 string dirName = Path.GetFileNameWithoutExtension(settingsModel.GitHub.RepoTargetFilePath); - string imageFileName = $"image-{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")} {imageBytes.GetHashCode()}.{imageType}"; - string imageHtml = $""; + // 注意: 图片文件名不能有空格, 否则会导致在 GitHub 无法预览 + string imageFileName = $"image-{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}-{imageBytes.GetHashCode()}.{imageType}"; + //string imageHtml = $""; // Markdown 图片标记 容易不显示 - //string imageMd = $"![{Path.GetFileNameWithoutExtension(imageFileName)}]({dirName}/{imageFileName})"; + string imageMd = $"![{Path.GetFileNameWithoutExtension(imageFileName)}]({dirName}/{imageFileName})"; imageDic.Add($"{dirName}/{imageFileName}", imageBytes); - fullMessageSb.AppendLine(imageHtml); + //fullMessageSb.AppendLine(imageHtml); + fullMessageSb.AppendLine(imageMd); #endregion } catch (Exception ex) @@ -221,7 +223,7 @@ public void OnFriendMessage((Bot s, FriendMessageEvent e) obj, string message, u } catch (Exception ex) { - obj.s.SendFriendMessage(friendUin, "笔记中的图片写入失败:"); + obj.s.SendFriendMessage(friendUin, $"{item.Key} 笔记中的图片写入失败:"); obj.s.SendFriendMessage(friendUin, ex.ToString()); } } diff --git a/plugins/QQNotePlugin/info.json b/plugins/QQNotePlugin/info.json index f06b764f4..3c5444c33 100644 --- a/plugins/QQNotePlugin/info.json +++ b/plugins/QQNotePlugin/info.json @@ -3,6 +3,6 @@ "DisplayName": "QQ写笔记", "Description": "利用 QQ 写笔记 (随笔/零碎知识点)", "Author": "yiyun", - "Version": "0.1.1", + "Version": "0.1.2", "SupportedVersions": [ "0.0.1" ] } \ No newline at end of file