diff --git a/Lagrange.Core.Test/Tests/WtLoginTest.cs b/Lagrange.Core.Test/Tests/WtLoginTest.cs
index 95a6aba..08d519c 100644
--- a/Lagrange.Core.Test/Tests/WtLoginTest.cs
+++ b/Lagrange.Core.Test/Tests/WtLoginTest.cs
@@ -36,7 +36,7 @@ public class WtLoginTest
var qrCode = await bot.FetchQrCode();
if (qrCode != null)
{
- await File.WriteAllBytesAsync("qr.png", qrCode);
+ await File.WriteAllBytesAsync("qr.png", qrCode.Value.QrCode);
await bot.LoginByQrCode();
}
}
diff --git a/Lagrange.Core/Common/Interface/Api/BotExt.cs b/Lagrange.Core/Common/Interface/Api/BotExt.cs
index d1cb145..213b527 100644
--- a/Lagrange.Core/Common/Interface/Api/BotExt.cs
+++ b/Lagrange.Core/Common/Interface/Api/BotExt.cs
@@ -7,9 +7,9 @@ public static class BotExt
///
/// Fetch the qrcode for QRCode Login
///
- /// the byte of QRCode, usually in the form of PNG
- public static async Task FetchQrCode(this BotContext bot)
- => await bot.ContextCollection.Business.WtExchangeLogic.FetchQrCode();
+ /// return url and qrcode image in PNG format
+ public static Task<(string Url, byte[] QrCode)?> FetchQrCode(this BotContext bot)
+ => bot.ContextCollection.Business.WtExchangeLogic.FetchQrCode();
///
/// Use this method to login by QrCode, you should call first
@@ -20,8 +20,8 @@ public static class BotExt
///
/// Use this method to login by password, EasyLogin may be preformed if there is sig in
///
- public static async Task LoginByPassword(this BotContext bot)
- => await bot.ContextCollection.Business.WtExchangeLogic.LoginByPassword();
+ public static Task LoginByPassword(this BotContext bot)
+ => bot.ContextCollection.Business.WtExchangeLogic.LoginByPassword();
///
/// Submit the captcha of the url given by the
diff --git a/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs b/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs
index bfc9652..fde5b12 100644
--- a/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs
+++ b/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs
@@ -56,7 +56,7 @@ internal class WtExchangeLogic : LogicBase
/// 1. resolve wtlogin.trans_emp CMD0x31 packet
/// 2. Schedule wtlogin.trans_emp CMD0x12 Task
///
- public async Task FetchQrCode()
+ public async Task<(string, byte[])?> FetchQrCode()
{
Collection.Log.LogInfo(Tag, "Connecting Servers...");
if (!await Collection.Socket.Connect()) return null;
@@ -73,7 +73,7 @@ internal class WtExchangeLogic : LogicBase
Collection.Keystore.Session.QrUrl = @event.Url;
Collection.Log.LogInfo(Tag, $"QrCode Fetched, Expiration: {@event.Expiration} seconds");
- return @event.QrCode;
+ return (@event.Url, @event.QrCode);
}
return null;
}
diff --git a/Lagrange.OneBot/LagrangeApp.cs b/Lagrange.OneBot/LagrangeApp.cs
index 1d723ec..c9e335f 100644
--- a/Lagrange.OneBot/LagrangeApp.cs
+++ b/Lagrange.OneBot/LagrangeApp.cs
@@ -72,7 +72,7 @@ public class LagrangeApp : IHost
var qrCode = await Instance.FetchQrCode();
if (qrCode != null)
{
- QrCodeHelper.Output(Instance.ContextCollection.Keystore.Session.QrUrl ?? "");
+ QrCodeHelper.Output(qrCode.Value.Url ?? "");
await Instance.LoginByQrCode();
}
}