diff --git a/ASFEnhance/ASFEnhance.cs b/ASFEnhance/ASFEnhance.cs index cadd64be..f1034c56 100644 --- a/ASFEnhance/ASFEnhance.cs +++ b/ASFEnhance/ASFEnhance.cs @@ -350,6 +350,7 @@ public Task OnLoaded() case "K" when access >= EAccess.FamilySharing: return Other.Command.ResponseExtractKeys(Utilities.GetArgsAsText(args, 1, ",")); + case "EHELP" when access >= EAccess.FamilySharing: case "HELP" when access >= EAccess.FamilySharing: return Other.Command.ResponseCommandHelp(args); diff --git a/ASFEnhance/AssemblyInfo.cs b/ASFEnhance/AssemblyInfo.cs index ee6ccef3..77ac998e 100644 --- a/ASFEnhance/AssemblyInfo.cs +++ b/ASFEnhance/AssemblyInfo.cs @@ -1,8 +1,8 @@ using System.Reflection; [assembly: System.CLSCompliant(false)] -[assembly: AssemblyVersion("1.6.1.435")] -[assembly: AssemblyFileVersion("1.6.1.435")] +[assembly: AssemblyVersion("1.6.1.439")] +[assembly: AssemblyFileVersion("1.6.1.439")] [assembly: AssemblyCopyright("Copyright © 2022 Chr_")] [assembly: AssemblyProduct("ASFEnhance")] diff --git a/ASFEnhance/Localization/Langs.Designer.cs b/ASFEnhance/Localization/Langs.Designer.cs index cd43d33a..8f1612d9 100644 --- a/ASFEnhance/Localization/Langs.Designer.cs +++ b/ASFEnhance/Localization/Langs.Designer.cs @@ -475,7 +475,7 @@ internal static string CommandHelpCmdNotFound { } /// - /// 查找类似 - {0} : {1} 的本地化字符串。 + /// 查找类似 - {0} {1} : {2} 的本地化字符串。 /// internal static string CommandHelpNoShortName { get { @@ -484,7 +484,16 @@ internal static string CommandHelpNoShortName { } /// - /// 查找类似 - {0} / {1} : {2} 的本地化字符串。 + /// 查找类似 无描述 的本地化字符串。 + /// + internal static string CommandHelpNoUsage { + get { + return ResourceManager.GetString("CommandHelpNoUsage", resourceCulture); + } + } + + /// + /// 查找类似 - {0} / {1} {2} : {3} 的本地化字符串。 /// internal static string CommandHelpWithShortName { get { diff --git a/ASFEnhance/Localization/Langs.en-US.resx b/ASFEnhance/Localization/Langs.en-US.resx index 739d2951..8f4732b2 100644 --- a/ASFEnhance/Localization/Langs.en-US.resx +++ b/ASFEnhance/Localization/Langs.en-US.resx @@ -577,10 +577,10 @@ 当前已经是最新版本, 无需更新插件 - - {0} / {1} : {2} + - {0} / {1} {2} : {3} - - {0} : {1} + - {0} {1} : {2} 找不到相关命令的帮助 @@ -588,4 +588,7 @@ - 余额充值: {0:0.00} {1} + + 无描述 + \ No newline at end of file diff --git a/ASFEnhance/Localization/Langs.resx b/ASFEnhance/Localization/Langs.resx index f6765a18..4b8bbe1a 100644 --- a/ASFEnhance/Localization/Langs.resx +++ b/ASFEnhance/Localization/Langs.resx @@ -577,10 +577,10 @@ **插件更新准备完毕,重启ASF即可应用更新.** - - {0} : {1} + - {0} {1} : {2} - - {0} / {1} : {2} + - {0} / {1} {2} : {3} 找不到相关命令的帮助 @@ -588,4 +588,7 @@ - 余额充值: {0:0.00} {1} + + 无描述 + \ No newline at end of file diff --git a/ASFEnhance/Localization/Langs.zh-Hans.resx b/ASFEnhance/Localization/Langs.zh-Hans.resx index 39892d5e..606ed1c1 100644 --- a/ASFEnhance/Localization/Langs.zh-Hans.resx +++ b/ASFEnhance/Localization/Langs.zh-Hans.resx @@ -577,10 +577,10 @@ 当前已经是最新版本, 无需更新插件 - - {0} / {1} : {2} + - {0} / {1} {2} : {3} - - {0} : {1} + - {0} {1} : {2} 找不到相关命令的帮助 @@ -588,4 +588,7 @@ - 余额充值: {0:0.00} {1} + + 无描述 + \ No newline at end of file diff --git a/ASFEnhance/Other/Command.cs b/ASFEnhance/Other/Command.cs index 6f950814..dfac558a 100644 --- a/ASFEnhance/Other/Command.cs +++ b/ASFEnhance/Other/Command.cs @@ -50,25 +50,27 @@ internal static string ResponseASFEnhanceVersion() sb.AppendLine(Langs.MultipleLineResult); sb.AppendLine(Langs.CommandHelp); - foreach (KeyValuePair item in Response.CommandUsage) + foreach (KeyValuePair item in Response.CommandArges) { string cmd = item.Key; - - string usage = Response.CommandUsage[cmd]; - - if (string.IsNullOrEmpty(usage)) + string args = string.IsNullOrEmpty(item.Value) ? Langs.NoArgs : item.Value; + string usage; + if (Response.CommandUsage.ContainsKey(cmd)) { - usage = Langs.NoArgs; + usage = Response.CommandUsage[cmd]; } - - if (Response.FullCommand.ContainsKey(cmd)) + else { - string shortCmd = Response.FullCommand[cmd]; - sb.AppendLine(string.Format(Langs.CommandHelpWithShortName, cmd, shortCmd, usage)); + usage = Langs.CommandHelpNoUsage; + } + if (Response.FullCmd2ShortCmd.ContainsKey(cmd)) + { + string shortCmd = Response.FullCmd2ShortCmd[cmd]; + sb.AppendLine(string.Format(Langs.CommandHelpWithShortName, cmd, shortCmd, args, usage)); } else { - sb.AppendLine(string.Format(Langs.CommandHelpNoShortName, cmd, usage)); + sb.AppendLine(string.Format(Langs.CommandHelpNoShortName, cmd, args, usage)); } } @@ -83,11 +85,8 @@ internal static string ResponseASFEnhanceVersion() internal static string? ResponseCommandHelp(string[] commands) { StringBuilder sb = new(); - sb.AppendLine(Langs.MultipleLineResult); - sb.AppendLine(Langs.CommandHelp); - int count = 0; bool skip = true; foreach (string command in commands) @@ -97,30 +96,38 @@ internal static string ResponseASFEnhanceVersion() skip = false; continue; } - string cmd = command.ToUpperInvariant(); - if (Response.ShortCommands.ContainsKey(cmd)) + if (Response.ShortCmd2FullCmd.ContainsKey(cmd)) { - cmd = Response.ShortCommands[cmd]; + cmd = Response.ShortCmd2FullCmd[cmd]; } - if (Response.CommandUsage.ContainsKey(cmd)) + if (Response.CommandArges.ContainsKey(cmd)) { count++; - string usage = Response.CommandUsage[cmd]; + string args = Response.CommandArges[cmd]; + if (string.IsNullOrEmpty(args)) + { + args = Langs.NoArgs; + } - if (string.IsNullOrEmpty(usage)) + string usage; + if (Response.CommandUsage.ContainsKey(cmd)) + { + usage = Response.CommandUsage[cmd]; + } + else { - usage = Langs.NoArgs; + usage = Langs.CommandHelpNoUsage; } - if (Response.FullCommand.ContainsKey(cmd)) + if (Response.FullCmd2ShortCmd.ContainsKey(cmd)) { - string shortCmd = Response.FullCommand[cmd]; - sb.AppendLine(string.Format(Langs.CommandHelpWithShortName, cmd, shortCmd, usage)); + string shortCmd = Response.FullCmd2ShortCmd[cmd]; + sb.AppendLine(string.Format(Langs.CommandHelpWithShortName, cmd, shortCmd, args, usage)); } else { - sb.AppendLine(string.Format(Langs.CommandHelpNoShortName, cmd, usage)); + sb.AppendLine(string.Format(Langs.CommandHelpNoShortName, cmd, args, usage)); } } } diff --git a/ASFEnhance/Other/Response.cs b/ASFEnhance/Other/Response.cs index bc76a645..254846bc 100644 --- a/ASFEnhance/Other/Response.cs +++ b/ASFEnhance/Other/Response.cs @@ -2,46 +2,77 @@ { internal static class Response { - internal static readonly Dictionary CommandUsage = new() { + internal static readonly Dictionary CommandArges = new() { // 其他 { "ASFENHANCE", ""}, - { "KEY", "KEY "}, + { "KEY", ""}, { "ASFEHELP", "ASFEHELP" }, - { "HELP", "HELP " }, + { "HELP", "" }, { "ASFEVERSION", "" }, { "ASFEUPDATE", "" }, // 社区 - { "PROFILE", "PROFILE [Bots]"}, - { "STEAMID", "STEAMID [Bots]"}, - { "FRIENDCODE", "FRIENDCODE [Bots]"}, - { "GROUPLIST", "GROUPLIST [Bots]"}, - { "JOINGROUP", "JOINGROUP [Bots] "}, - { "LEAVEGROUP [Bots] ", "LEAVEGROUP [Bots] "}, + { "PROFILE", "[Bots]"}, + { "STEAMID", "[Bots]"}, + { "FRIENDCODE", "[Bots]"}, + { "GROUPLIST", "[Bots]"}, + { "JOINGROUP", "[Bots] "}, + { "LEAVEGROUP", "[Bots] "}, // 愿望单 - { "ADDWISHLIST", "ADDWISHLIST [Bots] "}, - { "REMOVEWISHLIST", "REMOVEWISHLIST [Bots] "}, + { "ADDWISHLIST", "[Bots] "}, + { "REMOVEWISHLIST", "[Bots] "}, // 商店 - { "APPDETAIL", "APPDETAIL [Bots] "}, - { "SEARCH", "SEARCH [Bots] Keywords"}, - { "SUBS", "SUBS [Bots] "}, + { "APPDETAIL", "[Bots] "}, + { "SEARCH", "[Bots] Keywords"}, + { "SUBS", "[Bots] "}, { "PURCHASEHISTORY", ""}, - { "PUBLISHRECOMMENT", "PUBLISHRECOMMENT [Bots] COMMENT"}, - { "DELETERECOMMENT", "DELETERECOMMENT [Bots] "}, + { "PUBLISHRECOMMENT", "[Bots] COMMENT"}, + { "DELETERECOMMENT", "[Bots] "}, + // 购物车 + { "CART", "[Bots]"}, + { "ADDCART", "[Bots] "}, + { "CARTRESET", "[Bots]"}, + { "CARTCOUNTRY", "[Bots]"}, + { "SETCOUNTRY", "[Bots] "}, + { "PURCHASE", "[Bots]"}, + { "PURCHASEGIFT", "[BotA] BotB"}, + }; + + internal static readonly Dictionary CommandUsage = new() { + // 其他 + { "ASFENHANCE", "查看 ASFEnhance 的版本"}, + { "KEY", "从文本提取 key"}, + { "ASFEHELP", "查看全部指令说明" }, + { "HELP", "查看指令说明" }, + { "ASFEVERSION", "检查 ASFEnhance 的最新版本" }, + { "ASFEUPDATE", "更新 ASFEnhance 到最新版本" }, + // 社区 + { "PROFILE", "查看个人资料"}, + { "STEAMID", "查看 steamID"}, + { "FRIENDCODE", "查看好友代码"}, + { "GROUPLIST", "查看机器人的群组列表"}, + { "JOINGROUP", "加入指定群组"}, + { "LEAVEGROUP", "离开指定群组"}, + // 愿望单 + { "ADDWISHLIST", "添加愿望单"}, + { "REMOVEWISHLIST", "移除愿望单"}, + // 商店 + { "APPDETAIL", "获取 APP 信息, 无法获取锁区游戏信息, 仅支持APP"}, + { "SEARCH", "搜索商店"}, + { "SUBS", "查询商店 SUB, 支持APP/SUB/BUNDLE"}, + { "PURCHASEHISTORY", "读取商店消费历史记录"}, + { "PUBLISHRECOMMENT", "发布评测, APPID > 0 给好评, AppID < 0 给差评"}, + { "DELETERECOMMENT", "删除评测 (有 BUG,暂不能正常工作)"}, // 购物车 - { "CART", "CART [Bots]"}, - { "ADDCART", "ADDCART [Bots] "}, - { "CARTRESET", "CARTRESET [Bots]"}, - { "CARTCOUNTRY", "CARTCOUNTRY [Bots]"}, - { "SETCOUNTRY", "SETCOUNTRY [Bots] "}, - { "PURCHASE", "PURCHASE [Bots]"}, - { "PURCHASEGIFT", "PURCHASEGIFT [BotA] BotB"}, - // 调试 - { "COOKIES", "COOKIES [Bots]"}, - { "APIKEY", "APIKEY [Bots]"}, - { "ACCESSTOKEN", "ACCESSTOKEN [Bots]"}, + { "CART", "查看机器人购物车"}, + { "ADDCART", "添加购物车, 仅能使用SubID和BundleID"}, + { "CARTRESET", "清空购物车"}, + { "CARTCOUNTRY", "获取购物车可用结算区域(跟账号钱包和当前 IP 所在地有关)"}, + { "SETCOUNTRY", "购物车改区,可以用CARTCOUNTRY命令获取当前可选的CountryCode(仍然有 Bug)"}, + { "PURCHASE", "结算机器人的购物车, 只能为机器人自己购买 (使用 Steam 钱包余额结算)"}, + { "PURCHASEGIFT", "结算机器人 A 的购物车, 发送礼物给机器人 B (使用 Steam 钱包余额结算)"}, }; - internal static readonly Dictionary ShortCommands = new() { + internal static readonly Dictionary ShortCmd2FullCmd = new() { { "K", "KEY" }, { "ASFE", "ASFENHANCE" }, { "EHELP", "ASFEHELP" }, @@ -70,6 +101,6 @@ internal static class Response { "PCG", "PURCHASEGIFT" }, }; - internal static readonly Dictionary FullCommand = ShortCommands.ToDictionary(x => x.Value, x => x.Key); + internal static readonly Dictionary FullCmd2ShortCmd = ShortCmd2FullCmd.ToDictionary(x => x.Value, x => x.Key); } } diff --git a/ASFEnhance/Store/WebRequest.cs b/ASFEnhance/Store/WebRequest.cs index 6d64cb40..1d44ec37 100644 --- a/ASFEnhance/Store/WebRequest.cs +++ b/ASFEnhance/Store/WebRequest.cs @@ -167,12 +167,10 @@ internal static async Task DeleteRecommend(Bot bot, uint gameID) /// /// /// - private static async Task GetExchangeRatio(Bot bot, string currency) + private static async Task GetExchangeRatio(string currency) { Uri request = new($"https://api.exchangerate-api.com/v4/latest/{currency}"); - ObjectResponse response = await ASF.WebBrowser.UrlGetToJsonObject(request).ConfigureAwait(false); - return response?.Content; } @@ -184,9 +182,7 @@ internal static async Task DeleteRecommend(Bot bot, uint gameID) private static async Task GetAccountHistoryAjax(Bot bot) { Uri request = new(SteamStoreURL, "/account/history?l=schinese"); - HtmlDocumentResponse? response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request, referer: SteamStoreURL).ConfigureAwait(false); - return response; } @@ -199,7 +195,7 @@ internal static async Task DeleteRecommend(Bot bot, uint gameID) { // 读取在线汇率 string myCurrency = bot.WalletCurrency.ToString(); - ExchangeAPIResponse? exchangeRate = await GetExchangeRatio(bot, myCurrency).ConfigureAwait(false); + ExchangeAPIResponse? exchangeRate = await GetExchangeRatio(myCurrency).ConfigureAwait(false); if (exchangeRate == null) { return Langs.GetExchangeRateFailed;