From ebc7f862f42ac51cd0347d462033eb419c8d3ac5 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 10 May 2026 14:25:01 +0800 Subject: [PATCH] md 3 --- OshimaServers/Model/QQBot.cs | 2 +- OshimaWebAPI/Controllers/FunGameController.cs | 246 ++-- OshimaWebAPI/Services/RainBOTService.cs | 1193 ++++++----------- 3 files changed, 505 insertions(+), 936 deletions(-) diff --git a/OshimaServers/Model/QQBot.cs b/OshimaServers/Model/QQBot.cs index 3df7117..4e3a857 100644 --- a/OshimaServers/Model/QQBot.cs +++ b/OshimaServers/Model/QQBot.cs @@ -99,7 +99,7 @@ namespace Oshima.FunGame.OshimaServers.Model public KeyboardMessage? Keyboard { get; set; } // 方便从 string 隐式转换,旧代码无感知 - public static implicit operator BotReply(string text) => new() { Text = text }; + public static implicit operator BotReply(string text) => new() { Markdown = new() { Content = text } }; } public static class BotReplyExtension diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index e1fabee..33c87f4 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -57,7 +57,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("stats")] - public string GetStats([FromQuery] int? id = null) + public BotReply GetStats([FromQuery] int? id = null) { if (id != null && id > 0 && id <= FunGameConstant.Characters.Count) { @@ -150,7 +150,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("teamstats")] - public string GetTeamStats([FromQuery] int? id = null) + public BotReply GetTeamStats([FromQuery] int? id = null) { if (id != null && id > 0 && id <= FunGameConstant.Characters.Count) { @@ -325,7 +325,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("characterinfo")] - public string GetCharacterInfo([FromQuery] int? id = null) + public BotReply GetCharacterInfo([FromQuery] int? id = null) { if (id != null && id > 0 && id <= FunGameConstant.Characters.Count) { @@ -341,7 +341,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("skillinfo")] - public string GetSkillInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) + public BotReply GetSkillInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); PluginConfig pc = FunGameService.GetUserConfig(userid, out _); @@ -382,7 +382,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("skillinfoname")] - public string GetSkillInfo_Name([FromQuery] long? uid = null, [FromQuery] string? name = null) + public BotReply GetSkillInfo_Name([FromQuery] long? uid = null, [FromQuery] string? name = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); PluginConfig pc = FunGameService.GetUserConfig(userid, out _); @@ -423,7 +423,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("iteminfo")] - public string GetItemInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) + public BotReply GetItemInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); PluginConfig pc = FunGameService.GetUserConfig(userid, out _); @@ -459,7 +459,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("iteminfoname")] - public string GetItemInfo_Name([FromQuery] long? uid = null, [FromQuery] string? name = null) + public BotReply GetItemInfo_Name([FromQuery] long? uid = null, [FromQuery] string? name = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); PluginConfig pc = FunGameService.GetUserConfig(userid, out _); @@ -495,7 +495,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("newmagiccard")] - public string GenerateMagicCard() + public BotReply GenerateMagicCard() { Item i = FunGameService.GenerateMagicCard(); return i.ToString(false, true); @@ -503,7 +503,7 @@ namespace Oshima.FunGame.WebAPI.Controllers [AllowAnonymous] [HttpGet("newmagiccardpack")] - public string GenerateMagicCardPack() + public BotReply GenerateMagicCardPack() { Item? i = FunGameService.GenerateMagicCardPack(3); if (i != null) @@ -514,7 +514,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("createsaved")] - public string CreateSaved([FromQuery] long? uid = null, [FromQuery] string? openid = null) + public BotReply CreateSaved([FromQuery] long? uid = null, [FromQuery] string? openid = null) { using SQLHelper? sqlHelper = Factory.OpenFactory.GetSQLHelper(); @@ -595,7 +595,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("restoresaved")] - public string RestoreSaved([FromQuery] long? uid = null) + public BotReply RestoreSaved([FromQuery] long? uid = null) { //long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -623,7 +623,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("showsaved")] - public string ShowSaved([FromQuery] long? uid = null) + public BotReply ShowSaved([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -680,7 +680,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("rename")] - public string ReName([FromQuery] long? uid = null) + public BotReply ReName([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -733,7 +733,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("renamecustom")] - public string ReName_Custom([FromQuery] long? uid = null, [FromQuery] string name = "") + public BotReply ReName_Custom([FromQuery] long? uid = null, [FromQuery] string name = "") { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -812,7 +812,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("randomcustom")] - public string RandomCustomCharacter([FromQuery] long? uid = null, [FromQuery] bool? confirm = null) + public BotReply RandomCustomCharacter([FromQuery] long? uid = null, [FromQuery] bool? confirm = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); bool isConfirm = confirm ?? false; @@ -949,7 +949,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("cancelrandomcustom")] - public string CancelRandomCustomCharacter([FromQuery] long? uid = null) + public BotReply CancelRandomCustomCharacter([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -979,7 +979,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("inventoryinfo")] - public string GetInventoryInfo([FromQuery] long? uid = null) + public BotReply GetInventoryInfo([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -1584,7 +1584,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("newcustomcharacter")] - public string NewCustomCharacter([FromQuery] long? uid = null) + public BotReply NewCustomCharacter([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -1697,7 +1697,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("exchangecredits")] - public string ExchangeCredits([FromQuery] long? uid = null, [FromQuery] double? materials = null) + public BotReply ExchangeCredits([FromQuery] long? uid = null, [FromQuery] double? materials = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); double useMaterials = materials ?? 0; @@ -1732,7 +1732,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showcharacterinfo")] - public string GetCharacterInfoFromInventory([FromQuery] long? uid = null, [FromQuery] int? seq = null, [FromQuery] bool? simple = null) + public BotReply GetCharacterInfoFromInventory([FromQuery] long? uid = null, [FromQuery] int? seq = null, [FromQuery] bool? simple = null) { try { @@ -1785,7 +1785,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showcharacterskills")] - public string GetCharacterSkills([FromQuery] long? uid = null, [FromQuery] int? seq = null) + public BotReply GetCharacterSkills([FromQuery] long? uid = null, [FromQuery] int? seq = null) { try { @@ -1829,7 +1829,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showcharacteritems")] - public string GetCharacterItems([FromQuery] long? uid = null, [FromQuery] int? seq = null) + public BotReply GetCharacterItems([FromQuery] long? uid = null, [FromQuery] int? seq = null) { try { @@ -1873,7 +1873,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showiteminfo")] - public string GetItemInfoFromInventory([FromQuery] long? uid = null, [FromQuery] int? seq = null) + public BotReply GetItemInfoFromInventory([FromQuery] long? uid = null, [FromQuery] int? seq = null) { try { @@ -1910,7 +1910,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showiteminfoname")] - public string GetItemInfoFromInventory_Name([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? page = null) + public BotReply GetItemInfoFromInventory_Name([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? page = null) { try { @@ -2022,7 +2022,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("equipitem")] - public string EquipItem([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? i = null) + public BotReply EquipItem([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? i = null) { try { @@ -2109,7 +2109,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("unequipitem")] - public string UnEquipItem([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? i = null) + public BotReply UnEquipItem([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? i = null) { try { @@ -2344,7 +2344,7 @@ namespace Oshima.FunGame.WebAPI.Controllers /// /// [HttpPost("useitem")] - public string UseItem([FromQuery] long? uid = null, [FromQuery] int? id = null, [FromQuery] int? times = null, [FromBody] int[]? characters = null) + public BotReply UseItem([FromQuery] long? uid = null, [FromQuery] int? id = null, [FromQuery] int? times = null, [FromBody] int[]? characters = null) { try { @@ -2461,7 +2461,7 @@ namespace Oshima.FunGame.WebAPI.Controllers /// /// [HttpPost("useitem2")] - public string UseItem2([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromBody] int[]? characters = null) + public BotReply UseItem2([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromBody] int[]? characters = null) { try { @@ -2554,7 +2554,7 @@ namespace Oshima.FunGame.WebAPI.Controllers /// /// [HttpPost("useitem3")] - public string UseItem3([FromQuery] long? uid = null, [FromQuery] int? id = null, [FromQuery] int? id2 = null, [FromQuery] bool? c = null) + public BotReply UseItem3([FromQuery] long? uid = null, [FromQuery] int? id = null, [FromQuery] int? id2 = null, [FromQuery] bool? c = null) { try { @@ -2693,7 +2693,7 @@ namespace Oshima.FunGame.WebAPI.Controllers /// /// [HttpPost("useitem4")] - public string UseItem4([FromQuery] long uid, [FromBody] (int[], int[]) idsAndCids) + public BotReply UseItem4([FromQuery] long uid, [FromBody] (int[], int[]) idsAndCids) { try { @@ -2845,7 +2845,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("characterlevelup")] - public string CharacterLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? count = null) + public BotReply CharacterLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? count = null) { try { @@ -2916,7 +2916,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getlevelbreakneedy")] - public string GetLevelBreakNeedy([FromQuery] long? uid = null, [FromQuery] int? id = null) + public BotReply GetLevelBreakNeedy([FromQuery] long? uid = null, [FromQuery] int? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int characterIndex = id ?? 0; @@ -2952,7 +2952,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("characterlevelbreak")] - public string CharacterLevelBreak([FromQuery] long? uid = null, [FromQuery] int? c = null) + public BotReply CharacterLevelBreak([FromQuery] long? uid = null, [FromQuery] int? c = null) { try { @@ -3056,7 +3056,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("createitem")] - public string CreateItem([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromQuery] long? target = null) + public BotReply CreateItem([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromQuery] long? target = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); string itemName = name ?? ""; @@ -3239,7 +3239,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("createmagiccard")] - public string CreateMagicCard([FromQuery] long? uid = null, [FromQuery] long? target = null, [FromQuery] string? quality = null, [FromQuery] long magicId = 0, [FromQuery] int count = 1, [FromQuery] int str = 0, [FromQuery] int agi = 0, [FromQuery] int intelligence = 0) + public BotReply CreateMagicCard([FromQuery] long? uid = null, [FromQuery] long? target = null, [FromQuery] string? quality = null, [FromQuery] long magicId = 0, [FromQuery] int count = 1, [FromQuery] int str = 0, [FromQuery] int agi = 0, [FromQuery] int intelligence = 0) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); if (count <= 0) @@ -3306,7 +3306,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("decomposeitem")] - public string DecomposeItem([FromQuery] long? uid = null, [FromBody] int[]? items = null) + public BotReply DecomposeItem([FromQuery] long? uid = null, [FromBody] int[]? items = null) { try { @@ -3366,7 +3366,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("decomposeitem2")] - public string DecomposeItem2([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromQuery] bool allowLock = false) + public BotReply DecomposeItem2([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? count = null, [FromQuery] bool allowLock = false) { try { @@ -3441,7 +3441,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("decomposeitem3")] - public string DecomposeItem3([FromQuery] long? uid = null, [FromQuery] int? q = null) + public BotReply DecomposeItem3([FromQuery] long? uid = null, [FromQuery] int? q = null) { try { @@ -3509,7 +3509,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("conflatemagiccardpack")] - public string ConflateMagicCardPack([FromQuery] long? uid = null, [FromBody] int[]? items = null) + public BotReply ConflateMagicCardPack([FromQuery] long? uid = null, [FromBody] int[]? items = null) { try { @@ -3591,7 +3591,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("setmain")] - public string SetMain([FromQuery] long? uid = null, [FromQuery] int? c = null) + public BotReply SetMain([FromQuery] long? uid = null, [FromQuery] int? c = null) { try { @@ -3634,7 +3634,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("starttraining")] - public string StartTraining([FromQuery] long? uid = null, [FromQuery] int? c = null) + public BotReply StartTraining([FromQuery] long? uid = null, [FromQuery] int? c = null) { try { @@ -3683,7 +3683,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("stoptraining")] - public string StopTraining([FromQuery] long? uid = null) + public BotReply StopTraining([FromQuery] long? uid = null) { try { @@ -3761,7 +3761,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("gettraininginfo")] - public string GetTrainingInfo([FromQuery] long? uid = null) + public BotReply GetTrainingInfo([FromQuery] long? uid = null) { try { @@ -3808,7 +3808,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getskilllevelupneedy")] - public string GetSkillLevelUpNeedy([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] string? s = null) + public BotReply GetSkillLevelUpNeedy([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] string? s = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int characterIndex = c ?? 0; @@ -3856,7 +3856,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("skilllevelup")] - public string SkillLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] string? s = null) + public BotReply SkillLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] string? s = null) { try { @@ -4007,7 +4007,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getnormalattacklevelupneedy")] - public string GetNormalAttackLevelUpNeedy([FromQuery] long? uid = null, [FromQuery] int? c = null) + public BotReply GetNormalAttackLevelUpNeedy([FromQuery] long? uid = null, [FromQuery] int? c = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int characterIndex = c ?? 0; @@ -4044,7 +4044,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("normalattacklevelup")] - public string NormalAttackLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null) + public BotReply NormalAttackLevelUp([FromQuery] long? uid = null, [FromQuery] int? c = null) { try { @@ -4456,7 +4456,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clearsquad")] - public string ClearSquad([FromQuery] long? uid = null, [FromBody] int[]? c = null) + public BotReply ClearSquad([FromQuery] long? uid = null, [FromBody] int[]? c = null) { try { @@ -4639,7 +4639,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("checkworkingquest")] - public string CheckWorkingQuest([FromQuery] long? uid = null) + public BotReply CheckWorkingQuest([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -4753,7 +4753,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("settlequest")] - public string SettleQuest([FromQuery] long? uid = null) + public BotReply SettleQuest([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -4781,7 +4781,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("showmaincharacterorsquadstatus")] - public string ShowMainCharacterOrSquadStatus([FromQuery] long? uid = null, [FromQuery] bool? squad = null) + public BotReply ShowMainCharacterOrSquadStatus([FromQuery] long? uid = null, [FromQuery] bool? squad = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); bool showSquad = squad ?? false; @@ -4817,7 +4817,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("signin")] - public string SignIn([FromQuery] long uid = 0) + public BotReply SignIn([FromQuery] long uid = 0) { try { @@ -4878,7 +4878,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubjoin")] - public string ClubJoin([FromQuery] long? uid = null, [FromQuery] long? id = null) + public BotReply ClubJoin([FromQuery] long? uid = null, [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long clubid = id ?? 0; @@ -4947,7 +4947,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubquit")] - public string ClubQuit([FromQuery] long? uid = null) + public BotReply ClubQuit([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -5007,7 +5007,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubcreate")] - public string ClubCreate([FromQuery] long? uid = null, [FromQuery] bool? @public = null, [FromQuery] string? prefix = null) + public BotReply ClubCreate([FromQuery] long? uid = null, [FromQuery] bool? @public = null, [FromQuery] string? prefix = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); bool isPublic = @public ?? false; @@ -5085,7 +5085,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("clubshowinfo")] - public string ClubShowInfo([FromQuery] long? uid = null) + public BotReply ClubShowInfo([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -5152,7 +5152,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("clubshowlist")] - public string ClubShowList([FromQuery] long? uid = null, [FromQuery] int page = 0) + public BotReply ClubShowList([FromQuery] long? uid = null, [FromQuery] int page = 0) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -5201,7 +5201,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("clubshowmemberlist")] - public string ClubShowMemberList([FromQuery] long? uid = null, [FromQuery] int? type = null, [FromQuery] int? page = null) + public BotReply ClubShowMemberList([FromQuery] long? uid = null, [FromQuery] int? type = null, [FromQuery] int? page = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int showType = type ?? 0; @@ -5384,7 +5384,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubdisband")] - public string ClubDisband([FromQuery] long? uid = null) + public BotReply ClubDisband([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -5464,7 +5464,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubapprove")] - public string ClubApprove([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] bool? approval = null) + public BotReply ClubApprove([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] bool? approval = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long applicant = id ?? 0; @@ -5556,7 +5556,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubinvite")] - public string ClubInvite([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] bool cancel = false) + public BotReply ClubInvite([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] bool cancel = false) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long invitee = id ?? 0; @@ -5639,7 +5639,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubkick")] - public string ClubKick([FromQuery] long? uid = null, [FromQuery] long? id = null) + public BotReply ClubKick([FromQuery] long? uid = null, [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long kickid = id ?? 0; @@ -5721,7 +5721,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubchange")] - public string ClubChange([FromQuery] long? uid = null, [FromQuery] string? part = null, [FromBody] string[]? args = null) + public BotReply ClubChange([FromQuery] long? uid = null, [FromQuery] string? part = null, [FromBody] string[]? args = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); string name = part?.Trim().ToLower() ?? ""; @@ -5938,7 +5938,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("clubcontribution")] - public string ClubContribution([FromQuery] long uid = -1, [FromQuery] double credits = 0) + public BotReply ClubContribution([FromQuery] long uid = -1, [FromQuery] double credits = 0) { if (credits <= 0) { @@ -6048,7 +6048,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("dailystorebuy")] - public string DailyStoreBuy([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] int? count = null) + public BotReply DailyStoreBuy([FromQuery] long? uid = null, [FromQuery] long? id = null, [FromQuery] int? count = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long goodid = id ?? 0; @@ -6100,7 +6100,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("dailystoreshowinfo")] - public string DailyStoreShowInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) + public BotReply DailyStoreShowInfo([FromQuery] long? uid = null, [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long goodid = id ?? 0; @@ -6163,7 +6163,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("creategiftbox")] - public string CreateGiftBox([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] bool? checkRepeat = null, [FromQuery] int? maxRepeat = null) + public BotReply CreateGiftBox([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] bool? checkRepeat = null, [FromQuery] int? maxRepeat = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); string itemName = name ?? ""; @@ -6561,7 +6561,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("exploresettleall")] - public string SettleExploreAll([FromQuery] long? uid = null, [FromQuery] bool? skip = null) + public BotReply SettleExploreAll([FromQuery] long? uid = null, [FromQuery] bool? skip = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -6652,7 +6652,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("springoflife")] - public string SpringOfLife([FromQuery] long? uid = null) + public BotReply SpringOfLife([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -6707,7 +6707,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("pub")] - public string Pub([FromQuery] long? uid = null) + public BotReply Pub([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -6762,14 +6762,22 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getevents")] - public string GetEvents([FromQuery] long uid, [FromQuery] long? id = null) + public BotReply GetEvents([FromQuery] long uid, [FromQuery] long? id = null) { + MarkdownMessage md = new() + { + Content = busy + }; + BotReply reply = new() + { + Markdown = md + }; try { PluginConfig pc = FunGameService.GetUserConfig(uid, out bool isTimeout); if (isTimeout) { - return busy; + return reply; } if (pc.Count > 0) @@ -6787,17 +6795,19 @@ namespace Oshima.FunGame.WebAPI.Controllers } FunGameService.SetUserConfigButNotRelease(uid, pc, user); - return msg; + md.Content = msg; + return reply; } else { - return noSaved; + md.Content = noSaved; + return reply; } } catch (Exception e) { if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e); - return busy; + return reply; } finally { @@ -6806,7 +6816,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("performevent")] - public string PerformEvent([FromQuery] long? uid = null, [FromQuery] long? aid = null, [FromQuery] long? qid = null) + public BotReply PerformEvent([FromQuery] long? uid = null, [FromQuery] long? aid = null, [FromQuery] long? qid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long activityid = aid ?? 0; @@ -6872,7 +6882,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("claimeventprize")] - public string ClaimEventPrize([FromQuery] long? uid = null, [FromQuery] long? aid = null, [FromQuery] long? qid = null) + public BotReply ClaimEventPrize([FromQuery] long? uid = null, [FromQuery] long? aid = null, [FromQuery] long? qid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long activityid = aid ?? 0; @@ -6935,7 +6945,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("lockitem")] - public string LockItem([FromQuery] long? uid = null, [FromQuery] bool unlock = false, [FromBody] int[]? seq = null) + public BotReply LockItem([FromQuery] long? uid = null, [FromQuery] bool unlock = false, [FromBody] int[]? seq = null) { try { @@ -7028,7 +7038,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("lockitems")] - public string LockItems([FromQuery] long uid = -1, [FromQuery] string name = "", [FromQuery] int count = 0, [FromQuery] bool unlock = false) + public BotReply LockItems([FromQuery] long uid = -1, [FromQuery] string name = "", [FromQuery] int count = 0, [FromQuery] bool unlock = false) { try { @@ -7122,7 +7132,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("makeoffer")] - public string MakeOffer([FromQuery] long? uid = null, [FromQuery] long? offeree = null) + public BotReply MakeOffer([FromQuery] long? uid = null, [FromQuery] long? offeree = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7171,7 +7181,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("addofferitems")] - public string AddOfferItems([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool isOpposite = true, [FromBody] int[]? itemIds = null) + public BotReply AddOfferItems([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool isOpposite = true, [FromBody] int[]? itemIds = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long offerId = offer ?? -1; @@ -7214,7 +7224,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("sendoffer")] - public string SendOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null) + public BotReply SendOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7247,7 +7257,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("respondoffer")] - public string RespondOffer([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool accept = false) + public BotReply RespondOffer([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool accept = false) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long offerId = offer ?? -1; @@ -7288,7 +7298,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getoffer")] - public string GetOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null, [FromQuery] int page = 1) + public BotReply GetOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null, [FromQuery] int page = 1) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int showPage = page; @@ -7411,7 +7421,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("removeofferitems")] - public string RemoveOfferItems([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool isOpposite = true, [FromBody] int[]? itemIds = null) + public BotReply RemoveOfferItems([FromQuery] long? uid = null, [FromQuery] long? offer = null, [FromQuery] bool isOpposite = true, [FromBody] int[]? itemIds = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long offerId = offer ?? -1; @@ -7453,7 +7463,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("canceloffer")] - public string CancelOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null) + public BotReply CancelOffer([FromQuery] long? uid = null, [FromQuery] long? offerId = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7486,7 +7496,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("storesellitem")] - public string StoreSellItem([FromQuery] long? uid = null, [FromBody] int[]? items = null) + public BotReply StoreSellItem([FromQuery] long? uid = null, [FromBody] int[]? items = null) { try { @@ -7576,7 +7586,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getrenameinfo")] - public string GetReNameInfo([FromQuery] long? uid = null) + public BotReply GetReNameInfo([FromQuery] long? uid = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7638,7 +7648,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getrenameexamines")] - public string GetReNameExamines([FromQuery] long? uid = null, [FromQuery] int showPage = 1) + public BotReply GetReNameExamines([FromQuery] long? uid = null, [FromQuery] int showPage = 1) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7735,7 +7745,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("approverename")] - public string ApproveReName([FromQuery] long? uid = null, [FromQuery] long target = -1, [FromQuery] bool approve = true, [FromQuery] bool isClub = false, [FromQuery] string reason = "") + public BotReply ApproveReName([FromQuery] long? uid = null, [FromQuery] long target = -1, [FromQuery] bool approve = true, [FromQuery] bool isClub = false, [FromQuery] string reason = "") { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -7889,7 +7899,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketsellitem")] - public string MarketSellItem([FromQuery] long uid = -1, [FromQuery] double price = 0, [FromBody] int[]? itemIndexs = null) + public BotReply MarketSellItem([FromQuery] long uid = -1, [FromQuery] double price = 0, [FromBody] int[]? itemIndexs = null) { long userid = uid; itemIndexs ??= []; @@ -8001,7 +8011,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketshowlist")] - public string MarketShowList([FromQuery] long userid = -1, [FromQuery] int page = 0) + public BotReply MarketShowList([FromQuery] long userid = -1, [FromQuery] int page = 0) { try { @@ -8039,7 +8049,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketshowlistmysells")] - public string MarketShowListMySells([FromQuery] long userid = -1, [FromQuery] int page = 0) + public BotReply MarketShowListMySells([FromQuery] long userid = -1, [FromQuery] int page = 0) { try { @@ -8091,7 +8101,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketshowlistmybuys")] - public string MarketShowListMyBuys([FromQuery] long userid = -1, [FromQuery] int page = 0) + public BotReply MarketShowListMyBuys([FromQuery] long userid = -1, [FromQuery] int page = 0) { try { @@ -8143,7 +8153,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketiteminfo")] - public string MarketItemInfo([FromQuery] long userid = -1, [FromQuery] long itemid = 0) + public BotReply MarketItemInfo([FromQuery] long userid = -1, [FromQuery] long itemid = 0) { try { @@ -8189,7 +8199,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketbuyitem")] - public string MarketBuyItem([FromQuery] long userid = -1, [FromQuery] long itemid = 0, [FromQuery] int count = 1) + public BotReply MarketBuyItem([FromQuery] long userid = -1, [FromQuery] long itemid = 0, [FromQuery] int count = 1) { if (count <= 0) count = 1; try @@ -8259,7 +8269,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("marketdelistitem")] - public string MarketDelistItem([FromQuery] long userid = -1, [FromQuery] long itemid = 0) + public BotReply MarketDelistItem([FromQuery] long userid = -1, [FromQuery] long itemid = 0) { try { @@ -8423,7 +8433,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("showsystemstore")] - public string ShowSystemStore([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "") + public BotReply ShowSystemStore([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "") { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -8448,7 +8458,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("systemstorebuy")] - public string SystemStoreBuy([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "", [FromQuery] long id = 0, [FromQuery] int count = 0) + public BotReply SystemStoreBuy([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "", [FromQuery] long id = 0, [FromQuery] int count = 0) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); @@ -8499,7 +8509,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("systemstoreshowinfo")] - public string SystemStoreShowInfo([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "", [FromQuery] long? id = null) + public BotReply SystemStoreShowInfo([FromQuery] long? uid = null, [FromQuery] string storeRegion = "", [FromQuery] string storeName = "", [FromQuery] long? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long goodid = id ?? 0; @@ -8568,7 +8578,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("forgeitemcreate")] - public string ForgeItem_Create([FromQuery] long uid = -1, [FromBody] Dictionary? materials = null) + public BotReply ForgeItem_Create([FromQuery] long uid = -1, [FromBody] Dictionary? materials = null) { materials ??= []; @@ -8623,7 +8633,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("forgeitemmaster")] - public string ForgeItem_Master([FromQuery] long uid = -1, [FromQuery] long rid = 0, [FromQuery] int q = 0) + public BotReply ForgeItem_Master([FromQuery] long uid = -1, [FromQuery] long rid = 0, [FromQuery] int q = 0) { try { @@ -8690,7 +8700,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("forgeiteminfo")] - public string ForgeItem_Info([FromQuery] long uid = -1) + public BotReply ForgeItem_Info([FromQuery] long uid = -1) { try { @@ -8746,7 +8756,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("forgeitemcancel")] - public string ForgeItem_Cancel([FromQuery] long uid = -1) + public BotReply ForgeItem_Cancel([FromQuery] long uid = -1) { try { @@ -8795,7 +8805,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("forgeitemsimulate")] - public string ForgeItem_Simulate([FromQuery] long uid = -1) + public BotReply ForgeItem_Simulate([FromQuery] long uid = -1) { try { @@ -8843,7 +8853,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("forgeitemcomplete")] - public string ForgeItem_Complete([FromQuery] long uid = -1) + public BotReply ForgeItem_Complete([FromQuery] long uid = -1) { try { @@ -8933,7 +8943,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("chat")] - public string Chat([FromQuery] long uid = -1, [FromQuery] long uid2 = -1, [FromQuery] string msgTo = "") + public BotReply Chat([FromQuery] long uid = -1, [FromQuery] long uid2 = -1, [FromQuery] string msgTo = "") { try { @@ -8992,7 +9002,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("chatname")] - public string Chat_Name([FromQuery] long uid = -1, [FromQuery] string name = "", [FromQuery] string msgTo = "") + public BotReply Chat_Name([FromQuery] long uid = -1, [FromQuery] string name = "", [FromQuery] string msgTo = "") { try { @@ -9057,7 +9067,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("roomcreate")] - public string RoomCreate([FromQuery] long uid = -1, [FromQuery] string roomType = "", [FromQuery] string password = "", [FromQuery] string groupId = "") + public BotReply RoomCreate([FromQuery] long uid = -1, [FromQuery] string roomType = "", [FromQuery] string password = "", [FromQuery] string groupId = "") { try { @@ -9101,7 +9111,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("roominto")] - public string RoomInto([FromQuery] long uid = -1, [FromQuery] string roomid = "", [FromQuery] string password = "") + public BotReply RoomInto([FromQuery] long uid = -1, [FromQuery] string roomid = "", [FromQuery] string password = "") { try { @@ -9138,7 +9148,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("roomquit")] - public string RoomQuit([FromQuery] long uid = -1) + public BotReply RoomQuit([FromQuery] long uid = -1) { try { @@ -9175,7 +9185,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("roominfo")] - public string RoomInfo([FromQuery] long uid = -1) + public BotReply RoomInfo([FromQuery] long uid = -1) { try { @@ -9212,7 +9222,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("roomshowlist")] - public string RoomShowList([FromQuery] long uid = -1, [FromQuery] string groupId = "") + public BotReply RoomShowList([FromQuery] long uid = -1, [FromQuery] string groupId = "") { try { @@ -9291,7 +9301,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("getranking")] - public string GetRanking([FromQuery] long uid = -1, [FromQuery] int type = -1) + public BotReply GetRanking([FromQuery] long uid = -1, [FromQuery] int type = -1) { try { @@ -9428,7 +9438,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("additemstocharacter")] - public string AddItemsToCharacter([FromQuery] long uid = -1, [FromQuery] int cid = -1, [FromBody] int[]? ids = null) + public BotReply AddItemsToCharacter([FromQuery] long uid = -1, [FromQuery] int cid = -1, [FromBody] int[]? ids = null) { ids ??= []; try @@ -9529,7 +9539,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("removeitemsfromcharacter")] - public string RemoveItemsFromCharacter([FromQuery] long uid = -1, [FromQuery] int cid = -1, [FromBody] int[]? ids = null) + public BotReply RemoveItemsFromCharacter([FromQuery] long uid = -1, [FromQuery] int cid = -1, [FromBody] int[]? ids = null) { ids ??= []; try @@ -9680,7 +9690,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("template")] - public string Template([FromQuery] long uid = -1) + public BotReply Template([FromQuery] long uid = -1) { try { @@ -9759,7 +9769,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpGet("reload")] - public string Relaod([FromQuery] long? master = null) + public BotReply Relaod([FromQuery] long? master = null) { if (master != null && master == GeneralSettings.Master) { diff --git a/OshimaWebAPI/Services/RainBOTService.cs b/OshimaWebAPI/Services/RainBOTService.cs index 27bbefe..de2beb8 100644 --- a/OshimaWebAPI/Services/RainBOTService.cs +++ b/OshimaWebAPI/Services/RainBOTService.cs @@ -32,7 +32,7 @@ namespace Oshima.FunGame.WebAPI.Services private async Task SendAsync(IBotMessage msg, string title, BotReply reply, int? msgSeq = null) { - if (reply.Markdown != null) + if (reply.Markdown != null && !string.IsNullOrWhiteSpace(reply.Markdown.Content)) { // 发送 Markdown + 键盘 await SendMarkdownAsync(msg, title, reply.Markdown, reply.Keyboard, msgSeq); @@ -45,10 +45,10 @@ namespace Oshima.FunGame.WebAPI.Services Content = reply.Text }, reply.Keyboard, msgSeq); } - else + else if (!string.IsNullOrWhiteSpace(reply.Text)) { // 发送纯文本 - await SendTextAsync(msg, title, reply.Text ?? string.Empty, msgSeq: msgSeq); + await SendTextAsync(msg, title, reply.Text, msgSeq: msgSeq); } } @@ -189,7 +189,7 @@ namespace Oshima.FunGame.WebAPI.Services //if (e.Detail.StartsWith("绑定")) //{ // string detail = e.Detail.Replace("绑定", ""); - // string msg = ""; + // BotReply reply = ""; // if (long.TryParse(detail, out temp_qq)) // { // msg = QQController.Bind(new(openid, temp_qq)); @@ -198,7 +198,7 @@ namespace Oshima.FunGame.WebAPI.Services // { // msg = "绑定失败,请提供一个正确的QQ号!"; // } - // await SendAsync(e, "绑定", msg); + // await SendAsync(e, "绑定", reply); //} if (!e.IsGroup && e.Detail == "获取接入码") @@ -369,16 +369,16 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "查询服务器启动时间") { e.UseNotice = false; - string msg = TestController.GetLastLoginTime(); - await SendAsync(e, "查询服务器启动时间", msg); + BotReply reply = TestController.GetLastLoginTime(); + await SendAsync(e, "查询服务器启动时间", reply); return true; } if (e.Detail.StartsWith("查询任务计划")) { e.UseNotice = false; - string msg = TestController.GetTaskScheduler(e.Detail.Replace("查询任务计划", "")); - await SendAsync(e, "查询任务计划", msg); + BotReply reply = TestController.GetTaskScheduler(e.Detail.Replace("查询任务计划", "")); + await SendAsync(e, "查询任务计划", reply); return true; } @@ -582,11 +582,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查数据", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.GetStats(id); - if (msg != "") - { - await SendAsync(e, "查数据", msg); - } + BotReply reply = Controller.GetStats(id); + await SendAsync(e, "查数据", reply); } return result; } @@ -597,11 +594,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查团队数据", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.GetTeamStats(id); - if (msg != "") - { - await SendAsync(e, "查团队数据", msg); - } + BotReply reply = Controller.GetTeamStats(id); + await SendAsync(e, "查团队数据", reply); } return result; } @@ -634,11 +628,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查角色", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.GetCharacterInfo(id); - if (msg != "") - { - await SendAsync(e, "查角色", msg); - } + BotReply reply = Controller.GetCharacterInfo(id); + await SendAsync(e, "查角色", reply); } return result; } @@ -649,19 +640,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查技能", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.GetSkillInfo(uid, id); - if (msg != "") - { - await SendAsync(e, "查技能", msg); - } + BotReply reply = Controller.GetSkillInfo(uid, id); + await SendAsync(e, "查技能", reply); } else { - string msg = Controller.GetSkillInfo_Name(uid, detail); - if (msg != "") - { - await SendAsync(e, "查技能", msg); - } + BotReply reply = Controller.GetSkillInfo_Name(uid, detail); + await SendAsync(e, "查技能", reply); } return result; } @@ -672,19 +657,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查物品", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.GetItemInfo(uid, id); - if (msg != "") - { - await SendAsync(e, "查物品", msg); - } + BotReply reply = Controller.GetItemInfo(uid, id); + await SendAsync(e, "查物品", reply); } else { - string msg = Controller.GetItemInfo_Name(uid, detail); - if (msg != "") - { - await SendAsync(e, "查物品", msg); - } + BotReply reply = Controller.GetItemInfo_Name(uid, detail); + await SendAsync(e, "查物品", reply); } return result; } @@ -733,11 +712,8 @@ namespace Oshima.FunGame.WebAPI.Services targetUserID = long.Parse(match.Groups[8].Value); } - string msg = Controller.CreateMagicCard(uid, targetUserID, quality, magicID, count, str, agi, intelligence); - if (msg != "") - { - await SendAsync(e, "熟圣之力", msg); - } + BotReply reply = Controller.CreateMagicCard(uid, targetUserID, quality, magicID, count, str, agi, intelligence); + await SendAsync(e, "熟圣之力", reply); } else { @@ -768,11 +744,8 @@ namespace Oshima.FunGame.WebAPI.Services if (count > 0) { - string msg = Controller.CreateItem(uid, name, count, userid); - if (msg != "") - { - await SendAsync(e, "熟圣之力", msg); - } + BotReply reply = Controller.CreateItem(uid, name, count, userid); + await SendAsync(e, "熟圣之力", reply); } else { @@ -785,32 +758,23 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "预览魔法卡包") { e.UseNotice = false; - string msg = Controller.GenerateMagicCardPack(); - if (msg != "") - { - await SendAsync(e, "预览魔法卡包", msg); - } + BotReply reply = Controller.GenerateMagicCardPack(); + await SendAsync(e, "预览魔法卡包", reply); return result; } else if (e.Detail == "预览魔法卡") { e.UseNotice = false; - string msg = Controller.GenerateMagicCard(); - if (msg != "") - { - await SendAsync(e, "预览魔法卡", msg); - } + BotReply reply = Controller.GenerateMagicCard(); + await SendAsync(e, "预览魔法卡", reply); return result; } if (e.Detail == "创建存档") { e.UseNotice = false; - string msg = Controller.CreateSaved(uid, openid); - if (msg != "") - { - await SendAsync(e, "创建存档", "\r\n" + msg); - } + BotReply reply = Controller.CreateSaved(uid, openid); + await SendAsync(e, "创建存档", reply); return result; } @@ -832,33 +796,24 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "我的主战") { e.UseNotice = false; - string msg = Controller.GetCharacterInfoFromInventory(uid, 0); - if (msg != "") - { - await SendAsync(e, "我的主战", "\r\n" + msg); - } + BotReply reply = Controller.GetCharacterInfoFromInventory(uid, 0); + await SendAsync(e, "我的主战", reply); return result; } if (e.Detail == "我的状态") { e.UseNotice = false; - string msg = Controller.ShowMainCharacterOrSquadStatus(uid); - if (msg != "") - { - await SendAsync(e, "我的状态", "\r\n" + msg); - } + BotReply reply = Controller.ShowMainCharacterOrSquadStatus(uid); + await SendAsync(e, "我的状态", reply); return result; } if (e.Detail == "小队状态" || e.Detail == "我的小队状态") { e.UseNotice = false; - string msg = Controller.ShowMainCharacterOrSquadStatus(uid, true); - if (msg != "") - { - await SendAsync(e, "我的小队状态", "\r\n" + msg); - } + BotReply reply = Controller.ShowMainCharacterOrSquadStatus(uid, true); + await SendAsync(e, "我的小队状态", reply); return result; } @@ -871,11 +826,8 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "清空小队") { - string msg = Controller.ClearSquad(uid); - if (msg != "") - { - await SendAsync(e, "清空小队", "\r\n" + msg); - } + BotReply reply = Controller.ClearSquad(uid); + await SendAsync(e, "清空小队", reply); return result; } @@ -888,21 +840,15 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "确认还原存档") { - string msg = Controller.RestoreSaved(uid); - if (msg != "") - { - await SendAsync(e, "还原存档", "\r\n" + msg); - } + BotReply reply = Controller.RestoreSaved(uid); + await SendAsync(e, "还原存档", reply); return result; } if (e.Detail == "生成自建角色") { - string msg = Controller.NewCustomCharacter(uid); - if (msg != "") - { - await SendAsync(e, "生成自建角色", "\r\n" + msg); - } + BotReply reply = Controller.NewCustomCharacter(uid); + await SendAsync(e, "生成自建角色", reply); return result; } @@ -925,37 +871,31 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "查询改名") { - string msg = Controller.GetReNameInfo(uid); - if (msg != "") - { - await SendAsync(e, "查询改名", "\r\n" + msg); - } + BotReply reply = Controller.GetReNameInfo(uid); + await SendAsync(e, "查询改名", reply); return result; } if (e.Detail.StartsWith("改名审核")) { string detail = e.Detail.Replace("改名审核", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.GetReNameExamines(uid, page); + reply = Controller.GetReNameExamines(uid, page); } else { - msg = Controller.GetReNameExamines(uid); - } - if (msg != "") - { - await SendAsync(e, "改名审核", msg); + reply = Controller.GetReNameExamines(uid); } + await SendAsync(e, "改名审核", reply); return result; } if (e.Detail.StartsWith("改名拒绝")) { string detail = e.Detail.Replace("改名拒绝", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (strings.Length > 0) { @@ -966,12 +906,9 @@ namespace Oshima.FunGame.WebAPI.Services } if (long.TryParse(strings[0], out long target)) { - msg = Controller.ApproveReName(uid, target, false, false, reason); - } - if (msg != "") - { - await SendAsync(e, "改名拒绝", msg); + reply = Controller.ApproveReName(uid, target, false, false, reason); } + await SendAsync(e, "改名拒绝", reply); } return result; } @@ -979,22 +916,19 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("改名批准")) { string detail = e.Detail.Replace("改名批准", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long target)) { - msg = Controller.ApproveReName(uid, target); - } - if (msg != "") - { - await SendAsync(e, "改名批准", msg); + reply = Controller.ApproveReName(uid, target); } + await SendAsync(e, "改名批准", reply); return result; } if (e.Detail.StartsWith("社团改名拒绝")) { string detail = e.Detail.Replace("社团改名拒绝", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (strings.Length > 0) { @@ -1005,12 +939,9 @@ namespace Oshima.FunGame.WebAPI.Services } if (long.TryParse(strings[0], out long target)) { - msg = Controller.ApproveReName(uid, target, false, true, reason); - } - if (msg != "") - { - await SendAsync(e, "社团改名拒绝", msg); + reply = Controller.ApproveReName(uid, target, false, true, reason); } + await SendAsync(e, "社团改名拒绝", reply); } return result; } @@ -1018,15 +949,12 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("社团改名批准")) { string detail = e.Detail.Replace("社团改名批准", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long target)) { - msg = Controller.ApproveReName(uid, target, isClub: true); - } - if (msg != "") - { - await SendAsync(e, "社团改名批准", msg); + reply = Controller.ApproveReName(uid, target, isClub: true); } + await SendAsync(e, "社团改名批准", reply); return result; } @@ -1044,11 +972,8 @@ namespace Oshima.FunGame.WebAPI.Services { e.UseNotice = false; string detail = e.Detail.Replace("确认自定义改名", "").Trim(); - string msg = Controller.ReName_Custom(uid, detail); - if (msg != "") - { - await SendAsync(e, "改名", "\r\n" + msg); - } + BotReply reply = Controller.ReName_Custom(uid, detail); + await SendAsync(e, "改名", reply); return result; } @@ -1065,11 +990,8 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "确认角色重随") { - string msg = Controller.RandomCustomCharacter(uid, true); - if (msg != "") - { - await SendAsync(e, "角色重随", "\r\n" + msg); - } + BotReply reply = Controller.RandomCustomCharacter(uid, true); + await SendAsync(e, "角色重随", reply); return result; } @@ -1268,134 +1190,110 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("我角色", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("我角色", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int seq)) { - msg = Controller.GetCharacterInfoFromInventory(uid, seq, true); + reply = Controller.GetCharacterInfoFromInventory(uid, seq, true); } else { - msg = Controller.GetCharacterInfoFromInventory(uid, 1, true); - } - if (msg != "") - { - await SendAsync(e, "查库存角色", msg); + reply = Controller.GetCharacterInfoFromInventory(uid, 1, true); } + await SendAsync(e, "查库存角色", reply); return result; } if (e.Detail.StartsWith("我的角色", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("我的角色", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int seq)) { - msg = Controller.GetCharacterInfoFromInventory(uid, seq, false); + reply = Controller.GetCharacterInfoFromInventory(uid, seq, false); } else { - msg = Controller.GetCharacterInfoFromInventory(uid, 1, false); - } - if (msg != "") - { - await SendAsync(e, "查库存角色", msg); + reply = Controller.GetCharacterInfoFromInventory(uid, 1, false); } + await SendAsync(e, "查库存角色", reply); return result; } if (e.Detail.StartsWith("角色技能", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("角色技能", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int seq)) { - msg = Controller.GetCharacterSkills(uid, seq); + reply = Controller.GetCharacterSkills(uid, seq); } else { - msg = Controller.GetCharacterSkills(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "角色技能", msg); + reply = Controller.GetCharacterSkills(uid, 1); } + await SendAsync(e, "角色技能", reply); return result; } if (e.Detail.StartsWith("角色物品", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("角色物品", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int seq)) { - msg = Controller.GetCharacterItems(uid, seq); + reply = Controller.GetCharacterItems(uid, seq); } else { - msg = Controller.GetCharacterItems(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "角色物品", msg); + reply = Controller.GetCharacterItems(uid, 1); } + await SendAsync(e, "角色物品", reply); return result; } if (e.Detail.StartsWith("设置主战", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("设置主战", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.SetMain(uid, cid); + reply = Controller.SetMain(uid, cid); } else { - msg = Controller.SetMain(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "设置主战角色", msg); + reply = Controller.SetMain(uid, 1); } + await SendAsync(e, "设置主战角色", reply); return result; } if (e.Detail.StartsWith("开启练级", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("开始练级", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("开启练级", "").Replace("开始练级", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.StartTraining(uid, cid); + reply = Controller.StartTraining(uid, cid); } else { - msg = Controller.StartTraining(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "开启练级", msg); + reply = Controller.StartTraining(uid, 1); } + await SendAsync(e, "开启练级", reply); return result; } if (e.Detail == "练级信息") { - string msg = Controller.GetTrainingInfo(uid); - if (msg != "") - { - await SendAsync(e, "练级信息", "\r\n" + msg); - } + BotReply reply = Controller.GetTrainingInfo(uid); + await SendAsync(e, "练级信息", reply); return result; } if (e.Detail == "练级结算") { - string msg = Controller.StopTraining(uid); - if (msg != "") - { - await SendAsync(e, "练级结算", "\r\n" + msg); - } + BotReply reply = Controller.StopTraining(uid); + await SendAsync(e, "练级结算", reply); return result; } @@ -1409,31 +1307,22 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "任务信息") { - string msg = Controller.CheckWorkingQuest(uid); - if (msg != "") - { - await SendAsync(e, "任务信息", "\r\n" + msg); - } + BotReply reply = Controller.CheckWorkingQuest(uid); + await SendAsync(e, "任务信息", reply); return result; } if (e.Detail == "任务结算") { - string msg = Controller.SettleQuest(uid); - if (msg != "") - { - await SendAsync(e, "任务结算", "\r\n" + msg); - } + BotReply reply = Controller.SettleQuest(uid); + await SendAsync(e, "任务结算", reply); return result; } if (e.Detail == "签到") { - string msg = Controller.SignIn(uid); - if (msg != "") - { - await SendAsync(e, "签到", "\r\n" + msg); - } + BotReply reply = Controller.SignIn(uid); + await SendAsync(e, "签到", reply); return result; } @@ -1451,21 +1340,15 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("我的物品", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("我的物品", "").Trim(); - string msg; + BotReply reply; if (int.TryParse(detail, out int index)) { - msg = Controller.GetItemInfoFromInventory(uid, index); - if (msg != "") - { - await SendAsync(e, "查库存物品", msg); - return result; - } - } - msg = Controller.GetItemInfoFromInventory_Name(uid, detail); - if (msg != "") - { - await SendAsync(e, "查库存物品", msg); + reply = Controller.GetItemInfoFromInventory(uid, index); + await SendAsync(e, "查库存物品", reply); + return result; } + reply = Controller.GetItemInfoFromInventory_Name(uid, detail); + await SendAsync(e, "查库存物品", reply); return result; } @@ -1490,11 +1373,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (c != -1 && i != -1) { - string msg = Controller.UnEquipItem(uid, c, i); - if (msg != "") - { - await SendAsync(e, "取消装备", msg); - } + BotReply reply = Controller.UnEquipItem(uid, c, i); + await SendAsync(e, "取消装备", reply); } } return result; @@ -1509,11 +1389,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (c != -1 && i != -1) { - string msg = Controller.EquipItem(uid, c, i); - if (msg != "") - { - await SendAsync(e, "装备", msg); - } + BotReply reply = Controller.EquipItem(uid, c, i); + await SendAsync(e, "装备", reply); } } return result; @@ -1529,11 +1406,8 @@ namespace Oshima.FunGame.WebAPI.Services string s = strings[1].Trim(); if (c != -1 && s != "") { - string msg = Controller.GetSkillLevelUpNeedy(uid, c, s); - if (msg != "") - { - await SendAsync(e, "查看技能升级", msg); - } + BotReply reply = Controller.GetSkillLevelUpNeedy(uid, c, s); + await SendAsync(e, "查看技能升级", reply); } } return result; @@ -1549,11 +1423,8 @@ namespace Oshima.FunGame.WebAPI.Services string s = strings[1].Trim(); if (c != -1 && s != "") { - string msg = Controller.SkillLevelUp(uid, c, s); - if (msg != "") - { - await SendAsync(e, "技能升级", msg); - } + BotReply reply = Controller.SkillLevelUp(uid, c, s); + await SendAsync(e, "技能升级", reply); } } return result; @@ -1568,11 +1439,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (id1 != -1 && id2 != -1 && id3 != -1) { - string msg = Controller.ConflateMagicCardPack(uid, [id1, id2, id3]); - if (msg != "") - { - await SendAsync(e, "合成魔法卡", msg); - } + BotReply reply = Controller.ConflateMagicCardPack(uid, [id1, id2, id3]); + await SendAsync(e, "合成魔法卡", reply); } } return result; @@ -1581,95 +1449,80 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("角色升级", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("角色升级", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.CharacterLevelUp(uid, cid); + reply = Controller.CharacterLevelUp(uid, cid); } else { - msg = Controller.CharacterLevelUp(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "角色升级", msg); + reply = Controller.CharacterLevelUp(uid, 1); } + await SendAsync(e, "角色升级", reply); return result; } if (e.Detail.StartsWith("查看普攻升级", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("查看普攻升级", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.GetNormalAttackLevelUpNeedy(uid, cid); + reply = Controller.GetNormalAttackLevelUpNeedy(uid, cid); } else { - msg = Controller.GetNormalAttackLevelUpNeedy(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "查看普攻升级", msg); + reply = Controller.GetNormalAttackLevelUpNeedy(uid, 1); } + await SendAsync(e, "查看普攻升级", reply); return result; } if (e.Detail.StartsWith("普攻升级", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("普攻升级", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.NormalAttackLevelUp(uid, cid); + reply = Controller.NormalAttackLevelUp(uid, cid); } else { - msg = Controller.NormalAttackLevelUp(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "普攻升级", msg); + reply = Controller.NormalAttackLevelUp(uid, 1); } + await SendAsync(e, "普攻升级", reply); return result; } if (e.Detail.StartsWith("角色突破", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("角色突破", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.CharacterLevelBreak(uid, cid); + reply = Controller.CharacterLevelBreak(uid, cid); } else { - msg = Controller.CharacterLevelBreak(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "角色突破", msg); + reply = Controller.CharacterLevelBreak(uid, 1); } + await SendAsync(e, "角色突破", reply); return result; } if (e.Detail.StartsWith("突破信息", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("突破信息", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int cid)) { - msg = Controller.GetLevelBreakNeedy(uid, cid); + reply = Controller.GetLevelBreakNeedy(uid, cid); } else { - msg = Controller.GetLevelBreakNeedy(uid, 1); - } - if (msg != "") - { - await SendAsync(e, "突破信息", msg); + reply = Controller.GetLevelBreakNeedy(uid, 1); } + await SendAsync(e, "突破信息", reply); return result; } @@ -1688,11 +1541,8 @@ namespace Oshima.FunGame.WebAPI.Services int[] itemIds = [.. itemIdsString.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)]; if (itemIds.Length > 0) { - string msg = Controller.UseItem4(uid, (itemIds, characterIds)); - if (msg != "") - { - await SendAsync(e, "批量使用", msg); - } + BotReply reply = Controller.UseItem4(uid, (itemIds, characterIds)); + await SendAsync(e, "批量使用", reply); } } } @@ -1721,11 +1571,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (targetId > 0) { - string msg = Controller.UseItem3(uid, id, targetId, isCharacter); - if (msg != "") - { - await SendAsync(e, "使用魔法卡", msg); - } + BotReply reply = Controller.UseItem3(uid, id, targetId, isCharacter); + await SendAsync(e, "使用魔法卡", reply); } } } @@ -1746,19 +1593,13 @@ namespace Oshima.FunGame.WebAPI.Services if (!string.IsNullOrEmpty(itemId) && int.TryParse(itemId, out int id)) { - string msg = Controller.UseItem(uid, id, count, characterIds); - if (!string.IsNullOrEmpty(msg)) - { - await SendAsync(e, "使用", msg); - } + BotReply reply = Controller.UseItem(uid, id, count, characterIds); + await SendAsync(e, "使用", reply); } else if (!string.IsNullOrEmpty(itemPart)) { - string msg = Controller.UseItem2(uid, itemPart, count, characterIds); - if (msg != "") - { - await SendAsync(e, "使用", msg); - } + BotReply reply = Controller.UseItem2(uid, itemPart, count, characterIds); + await SendAsync(e, "使用", reply); } } } @@ -1777,11 +1618,8 @@ namespace Oshima.FunGame.WebAPI.Services ids.Add(id); } } - string msg = Controller.DecomposeItem(uid, [.. ids]); - if (msg != "") - { - await SendAsync(e, "分解物品", msg); - } + BotReply reply = Controller.DecomposeItem(uid, [.. ids]); + await SendAsync(e, "分解物品", reply); return result; } @@ -1796,11 +1634,8 @@ namespace Oshima.FunGame.WebAPI.Services string itemName = match.Groups["itemName"].Value.Trim(); if (int.TryParse(match.Groups["count"].Value, out int count)) { - string msg = Controller.DecomposeItem2(uid, itemName, count, true); - if (msg != "") - { - await SendAsync(e, "分解", msg); - } + BotReply reply = Controller.DecomposeItem2(uid, itemName, count, true); + await SendAsync(e, "分解", reply); } } @@ -1817,11 +1652,8 @@ namespace Oshima.FunGame.WebAPI.Services string itemName = match.Groups["itemName"].Value.Trim(); if (int.TryParse(match.Groups["count"].Value, out int count)) { - string msg = Controller.DecomposeItem2(uid, itemName, count); - if (msg != "") - { - await SendAsync(e, "分解", msg); - } + BotReply reply = Controller.DecomposeItem2(uid, itemName, count); + await SendAsync(e, "分解", reply); } } @@ -1833,11 +1665,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("品质分解", "").Trim(); if (int.TryParse(detail, out int q)) { - string msg = Controller.DecomposeItem3(uid, q); - if (msg != "") - { - await SendAsync(e, "品质分解", msg); - } + BotReply reply = Controller.DecomposeItem3(uid, q); + await SendAsync(e, "品质分解", reply); } return result; @@ -1858,11 +1687,8 @@ namespace Oshima.FunGame.WebAPI.Services { userid = temp; } - string msg = Controller.CreateItem(uid, name, count, userid); - if (msg != "") - { - await SendAsync(e, "熟圣之力", msg); - } + BotReply reply = Controller.CreateItem(uid, name, count, userid); + await SendAsync(e, "熟圣之力", reply); } else { @@ -2019,11 +1845,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("加入社团", "").Trim(); if (int.TryParse(detail, out int c)) { - string msg = Controller.ClubJoin(uid, c); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubJoin(uid, c); + await SendAsync(e, "社团", reply); } return result; } @@ -2033,11 +1856,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("邀请加入", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.ClubInvite(uid, id); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubInvite(uid, id); + await SendAsync(e, "社团", reply); } return result; } @@ -2047,11 +1867,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("取消邀请加入", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = Controller.ClubInvite(uid, id, true); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubInvite(uid, id, true); + await SendAsync(e, "社团", reply); } return result; } @@ -2065,60 +1882,45 @@ namespace Oshima.FunGame.WebAPI.Services isPublic = false; } detail = detail.Replace("私密", "").Trim(); - string msg = Controller.ClubCreate(uid, isPublic, detail); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubCreate(uid, isPublic, detail); + await SendAsync(e, "社团", reply); return result; } if (e.Detail == "退出社团") { - string msg = Controller.ClubQuit(uid); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubQuit(uid); + await SendAsync(e, "社团", reply); return result; } if (e.Detail == "我的社团") { - string msg = Controller.ClubShowInfo(uid); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowInfo(uid); + await SendAsync(e, "社团", reply); return result; } if (e.Detail.StartsWith("社团列表")) { string detail = e.Detail.Replace("社团列表", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.ClubShowList(uid, page); + reply = Controller.ClubShowList(uid, page); } else { - msg = Controller.ClubShowList(uid, 1); - } - if (msg.Trim() != "") - { - await SendAsync(e, "社团", msg); + reply = Controller.ClubShowList(uid, 1); } + await SendAsync(e, "社团", reply); return result; } if (e.Detail == "解散社团") { - string msg = Controller.ClubDisband(uid); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubDisband(uid); + await SendAsync(e, "社团", reply); return result; } @@ -2127,19 +1929,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查看社团成员", "").Trim(); if (int.TryParse(detail, out int page) && page > 0) { - string msg = Controller.ClubShowMemberList(uid, 0, page); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 0, page); + await SendAsync(e, "社团", reply); } else { - string msg = Controller.ClubShowMemberList(uid, 0, 1); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 0, 1); + await SendAsync(e, "社团", reply); } return result; } @@ -2149,19 +1945,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查看社团管理", "").Trim(); if (int.TryParse(detail, out int page) && page > 0) { - string msg = Controller.ClubShowMemberList(uid, 1, page); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 1, page); + await SendAsync(e, "社团", reply); } else { - string msg = Controller.ClubShowMemberList(uid, 1, 1); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 1, 1); + await SendAsync(e, "社团", reply); } return result; } @@ -2171,19 +1961,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查看申请人列表", "").Trim(); if (int.TryParse(detail, out int page) && page > 0) { - string msg = Controller.ClubShowMemberList(uid, 2, page); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 2, page); + await SendAsync(e, "社团", reply); } else { - string msg = Controller.ClubShowMemberList(uid, 2, 1); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 2, 1); + await SendAsync(e, "社团", reply); } return result; } @@ -2193,19 +1977,13 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("查看受邀人列表", "").Trim(); if (int.TryParse(detail, out int page) && page > 0) { - string msg = Controller.ClubShowMemberList(uid, 3, page); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 3, page); + await SendAsync(e, "社团", reply); } else { - string msg = Controller.ClubShowMemberList(uid, 3, 1); - if (msg != "") - { - await SendAsync(e, "社团", "\r\n" + msg); - } + BotReply reply = Controller.ClubShowMemberList(uid, 3, 1); + await SendAsync(e, "社团", reply); } return result; } @@ -2215,11 +1993,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("社团批准", "").Replace("@", "").Trim(); if (long.TryParse(detail, out long id)) { - string msg = Controller.ClubApprove(uid, id, true); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubApprove(uid, id, true); + await SendAsync(e, "社团", reply); } return result; } @@ -2229,11 +2004,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("社团拒绝", "").Replace("@", "").Trim(); if (long.TryParse(detail, out long id)) { - string msg = Controller.ClubApprove(uid, id, false); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubApprove(uid, id, false); + await SendAsync(e, "社团", reply); } return result; } @@ -2243,11 +2015,8 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("社团踢出", "").Replace("@", "").Trim(); if (long.TryParse(detail, out long id)) { - string msg = Controller.ClubKick(uid, id); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubKick(uid, id); + await SendAsync(e, "社团", reply); } return result; } @@ -2275,11 +2044,8 @@ namespace Oshima.FunGame.WebAPI.Services { args = [.. strings[1..]]; } - string msg = Controller.ClubChange(uid, part, [.. args]); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubChange(uid, part, [.. args]); + await SendAsync(e, "社团", reply); } return result; } @@ -2288,26 +2054,20 @@ namespace Oshima.FunGame.WebAPI.Services { string detail = e.Detail.Replace("社团转让", "").Replace("@", "").Trim(); List args = [detail]; - string msg = Controller.ClubChange(uid, "setmaster", [.. args]); - if (msg != "") - { - await SendAsync(e, "社团", msg); - } + BotReply reply = Controller.ClubChange(uid, "setmaster", [.. args]); + await SendAsync(e, "社团", reply); return result; } if (e.Detail.StartsWith("社团捐献")) { string detail = e.Detail.Replace("社团捐献", "").Trim(); - string msg = ""; + BotReply reply = ""; if (double.TryParse(detail, out double credits)) { - msg = Controller.ClubContribution(uid, credits); - } - if (msg.Trim() != "") - { - await SendAsync(e, "社团", msg); + reply = Controller.ClubContribution(uid, credits); } + await SendAsync(e, "社团", reply); return result; } @@ -2338,19 +2098,16 @@ namespace Oshima.FunGame.WebAPI.Services { count = temp; } - string msg = ""; + BotReply reply = ""; if (model.IsDaily) { - msg = Controller.DailyStoreBuy(uid, id, count); + reply = Controller.DailyStoreBuy(uid, id, count); } else { - msg = Controller.SystemStoreBuy(uid, model.StoreRegion, model.StoreName, id, count); - } - if (msg != "") - { - await SendAsync(e, "商店购买", msg); + reply = Controller.SystemStoreBuy(uid, model.StoreRegion, model.StoreName, id, count); } + await SendAsync(e, "商店购买", reply); } return result; } @@ -2365,19 +2122,16 @@ namespace Oshima.FunGame.WebAPI.Services string detail = e.Detail.Replace("商店查看", "").Trim(); if (int.TryParse(detail, out int id)) { - string msg = ""; + BotReply reply = ""; if (model.IsDaily) { - msg = Controller.DailyStoreShowInfo(uid, id); + reply = Controller.DailyStoreShowInfo(uid, id); } else { - msg = Controller.SystemStoreShowInfo(uid, model.StoreRegion, model.StoreName, id); - } - if (msg != "") - { - await SendAsync(e, "商店", msg); + reply = Controller.SystemStoreShowInfo(uid, model.StoreRegion, model.StoreName, id); } + await SendAsync(e, "商店", reply); } return result; } @@ -2436,11 +2190,8 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "探索结算") { - string msg = Controller.SettleExploreAll(uid); - if (msg != "") - { - await SendAsync(e, "探索结算", string.Join("\r\n", msg)); - } + BotReply reply = Controller.SettleExploreAll(uid); + await SendAsync(e, "探索结算", string.Join("\r\n", reply)); return result; } @@ -2516,21 +2267,15 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "生命之泉") { - string msg = Controller.SpringOfLife(uid); - if (msg != "") - { - await SendAsync(e, "生命之泉", string.Join("\r\n", msg)); - } + BotReply reply = Controller.SpringOfLife(uid); + await SendAsync(e, "生命之泉", string.Join("\r\n", reply)); return result; } if (e.Detail == "酒馆" || e.Detail == "上酒") { - string msg = Controller.Pub(uid); - if (msg != "") - { - await SendAsync(e, "酒馆", string.Join("\r\n", msg)); - } + BotReply reply = Controller.Pub(uid); + await SendAsync(e, "酒馆", string.Join("\r\n", reply)); return result; } @@ -2538,11 +2283,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (FunGameService.Activities.FirstOrDefault(a => a.Name == "毕业季") is Activity activity && activity.Status == ActivityState.InProgress) { - string msg = Controller.CreateGiftBox(uid, "毕业礼包", true, 2); - if (msg != "") - { - await SendAsync(e, "毕业礼包", string.Join("\r\n", msg)); - } + BotReply reply = Controller.CreateGiftBox(uid, "毕业礼包", true, 2); + await SendAsync(e, "毕业礼包", string.Join("\r\n", reply)); } else { @@ -2553,25 +2295,19 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "活动" || e.Detail == "活动中心") { - string msg = Controller.GetEvents(uid); - if (msg != "") - { - await SendAsync(e, "活动中心", string.Join("\r\n", msg)); - } + BotReply reply = Controller.GetEvents(uid); + await SendAsync(e, "活动中心", string.Join("\r\n", reply)); return result; } if (e.Detail.StartsWith("查活动")) { string detail = e.Detail.Replace("查活动", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int eid)) { - msg = Controller.GetEvents(uid, eid); - if (msg.Trim() != "") - { - await SendAsync(e, "查活动", msg); - } + reply = Controller.GetEvents(uid, eid); + await SendAsync(e, "查活动", reply); } return result; } @@ -2585,11 +2321,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (aid != -1 && qid != -1) { - string msg = Controller.PerformEvent(uid, aid, qid); - if (msg != "") - { - await SendAsync(e, "做活动任务", msg); - } + BotReply reply = Controller.PerformEvent(uid, aid, qid); + await SendAsync(e, "做活动任务", reply); } } return result; @@ -2604,11 +2337,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (aid != -1 && qid != -1) { - string msg = Controller.ClaimEventPrize(uid, aid, qid); - if (msg != "") - { - await SendAsync(e, "领取奖励", msg); - } + BotReply reply = Controller.ClaimEventPrize(uid, aid, qid); + await SendAsync(e, "领取奖励", reply); } } return result; @@ -2624,11 +2354,8 @@ namespace Oshima.FunGame.WebAPI.Services string itemName = match.Groups["itemName"].Value.Trim(); if (int.TryParse(match.Groups["count"].Value, out int count)) { - string msg = Controller.LockItems(uid, itemName, count, false); - if (msg != "") - { - await SendAsync(e, "批量锁定", msg); - } + BotReply reply = Controller.LockItems(uid, itemName, count, false); + await SendAsync(e, "批量锁定", reply); } } @@ -2645,11 +2372,8 @@ namespace Oshima.FunGame.WebAPI.Services string itemName = match.Groups["itemName"].Value.Trim(); if (int.TryParse(match.Groups["count"].Value, out int count)) { - string msg = Controller.LockItems(uid, itemName, count, true); - if (msg != "") - { - await SendAsync(e, "批量解锁", msg); - } + BotReply reply = Controller.LockItems(uid, itemName, count, true); + await SendAsync(e, "批量解锁", reply); } } @@ -2659,7 +2383,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("上锁") || e.Detail.StartsWith("锁定")) { string detail = e.Detail.Replace("上锁", "").Replace("锁定", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2671,11 +2395,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 0) { - msg = Controller.LockItem(uid, false, [.. indexs]); - if (msg.Trim() != "") - { - await SendAsync(e, "上锁", msg); - } + reply = Controller.LockItem(uid, false, [.. indexs]); + await SendAsync(e, "上锁", reply); } return result; } @@ -2683,7 +2404,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("解锁")) { string detail = e.Detail.Replace("解锁", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2695,11 +2416,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 0) { - msg = Controller.LockItem(uid, true, [.. indexs]); - if (msg.Trim() != "") - { - await SendAsync(e, "解锁", msg); - } + reply = Controller.LockItem(uid, true, [.. indexs]); + await SendAsync(e, "解锁", reply); } return result; } @@ -2707,14 +2425,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "创建报价")) { string detail = e.Detail.Replace("创建报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long target)) { - msg = Controller.MakeOffer(uid, target); - if (msg.Trim() != "") - { - await SendAsync(e, "创建报价", msg); - } + reply = Controller.MakeOffer(uid, target); + await SendAsync(e, "创建报价", reply); } return result; } @@ -2722,33 +2437,27 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "我的报价")) { string detail = e.Detail.Replace("我的报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.GetOffer(uid, null, page); + reply = Controller.GetOffer(uid, null, page); } else { - msg = Controller.GetOffer(uid); - } - if (msg.Trim() != "") - { - await SendAsync(e, "我的报价", msg); + reply = Controller.GetOffer(uid); } + await SendAsync(e, "我的报价", reply); return result; } if (e.Detail.StartsWith(value: "查报价")) { string detail = e.Detail.Replace("查报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long id)) { - msg = Controller.GetOffer(uid, id); - if (msg.Trim() != "") - { - await SendAsync(e, "查报价", msg); - } + reply = Controller.GetOffer(uid, id); + await SendAsync(e, "查报价", reply); } return result; } @@ -2756,14 +2465,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "发送报价")) { string detail = e.Detail.Replace("发送报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long id)) { - msg = Controller.SendOffer(uid, id); - if (msg.Trim() != "") - { - await SendAsync(e, "发送报价", msg); - } + reply = Controller.SendOffer(uid, id); + await SendAsync(e, "发送报价", reply); } return result; } @@ -2771,14 +2477,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "取消报价")) { string detail = e.Detail.Replace("取消报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long id)) { - msg = Controller.CancelOffer(uid, id); - if (msg.Trim() != "") - { - await SendAsync(e, "取消报价", msg); - } + reply = Controller.CancelOffer(uid, id); + await SendAsync(e, "取消报价", reply); } return result; } @@ -2786,14 +2489,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "接受报价")) { string detail = e.Detail.Replace("接受报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long id)) { - msg = Controller.RespondOffer(uid, id, true); - if (msg.Trim() != "") - { - await SendAsync(e, "接受报价", msg); - } + reply = Controller.RespondOffer(uid, id, true); + await SendAsync(e, "接受报价", reply); } return result; } @@ -2801,14 +2501,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "拒绝报价")) { string detail = e.Detail.Replace("拒绝报价", "").Trim(); - string msg = ""; + BotReply reply = ""; if (long.TryParse(detail, out long id)) { - msg = Controller.RespondOffer(uid, id, false); - if (msg.Trim() != "") - { - await SendAsync(e, "拒绝报价", msg); - } + reply = Controller.RespondOffer(uid, id, false); + await SendAsync(e, "拒绝报价", reply); } return result; } @@ -2816,7 +2513,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "报价添加物品")) { string detail = e.Detail.Replace("报价添加物品", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2828,15 +2525,12 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 1) { - msg = Controller.AddOfferItems(uid, indexs[0], false, [.. indexs[1..]]); - if (msg.Trim() != "") - { - await SendAsync(e, "报价添加物品", msg); - } + reply = Controller.AddOfferItems(uid, indexs[0], false, [.. indexs[1..]]); + await SendAsync(e, "报价添加物品", reply); } else { - msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; + reply = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; } return result; } @@ -2844,7 +2538,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "报价添加对方物品")) { string detail = e.Detail.Replace("报价添加对方物品", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2856,15 +2550,12 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 1) { - msg = Controller.AddOfferItems(uid, indexs[0], true, [.. indexs[1..]]); - if (msg.Trim() != "") - { - await SendAsync(e, "报价添加对方物品", msg); - } + reply = Controller.AddOfferItems(uid, indexs[0], true, [.. indexs[1..]]); + await SendAsync(e, "报价添加对方物品", reply); } else { - msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; + reply = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; } return result; } @@ -2872,7 +2563,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "报价移除物品")) { string detail = e.Detail.Replace("报价移除物品", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2884,15 +2575,12 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 1) { - msg = Controller.RemoveOfferItems(uid, indexs[0], false, [.. indexs[1..]]); - if (msg.Trim() != "") - { - await SendAsync(e, "报价移除物品", msg); - } + reply = Controller.RemoveOfferItems(uid, indexs[0], false, [.. indexs[1..]]); + await SendAsync(e, "报价移除物品", reply); } else { - msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; + reply = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; } return result; } @@ -2900,7 +2588,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith(value: "报价移除对方物品")) { string detail = e.Detail.Replace("报价移除对方物品", "").Trim(); - string msg = ""; + BotReply reply = ""; string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); List indexs = []; foreach (string s in strings) @@ -2912,15 +2600,12 @@ namespace Oshima.FunGame.WebAPI.Services } if (indexs.Count > 1) { - msg = Controller.RemoveOfferItems(uid, indexs[0], true, [.. indexs[1..]]); - if (msg.Trim() != "") - { - await SendAsync(e, "报价移除对方物品", msg); - } + reply = Controller.RemoveOfferItems(uid, indexs[0], true, [.. indexs[1..]]); + await SendAsync(e, "报价移除对方物品", reply); } else { - msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; + reply = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。"; } return result; } @@ -2936,11 +2621,8 @@ namespace Oshima.FunGame.WebAPI.Services ids.Add(id); } } - string msg = Controller.StoreSellItem(uid, [.. ids]); - if (msg != "") - { - await SendAsync(e, "商店出售", msg); - } + BotReply reply = Controller.StoreSellItem(uid, [.. ids]); + await SendAsync(e, "商店出售", reply); return result; } @@ -3045,110 +2727,86 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "后勤部") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "武器商会") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "杂货铺") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "基金会") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "锻造商店") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "赛马商店") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail == "共斗商店") { - string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative"); - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + BotReply reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative"); + await SendAsync(e, "商店", reply); return result; } if (e.Detail.StartsWith("商店")) { string detail = e.Detail.Replace("商店", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int storeId)) { switch (storeId) { case 1: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics"); break; case 2: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons"); break; case 3: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki"); break; case 4: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare"); break; case 5: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge"); break; case 6: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing"); break; case 7: - msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative"); + reply = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative"); break; default: break; } - if (msg.Trim() != "") - { - await SendAsync(e, "商店", msg); - } + await SendAsync(e, "商店", reply); } return result; } @@ -3209,51 +2867,36 @@ namespace Oshima.FunGame.WebAPI.Services } } - string msg = Controller.ForgeItem_Create(uid, recipeItems); - if (msg != "") - { - await SendAsync(e, "锻造配方", msg); - } + BotReply reply = Controller.ForgeItem_Create(uid, recipeItems); + await SendAsync(e, "锻造配方", reply); return result; } if (e.Detail.StartsWith("模拟锻造")) { - string msg = Controller.ForgeItem_Simulate(uid); - if (msg != "") - { - await SendAsync(e, "模拟锻造", msg); - } + BotReply reply = Controller.ForgeItem_Simulate(uid); + await SendAsync(e, "模拟锻造", reply); return result; } if (e.Detail.StartsWith("取消锻造")) { - string msg = Controller.ForgeItem_Cancel(uid); - if (msg != "") - { - await SendAsync(e, "取消锻造", msg); - } + BotReply reply = Controller.ForgeItem_Cancel(uid); + await SendAsync(e, "取消锻造", reply); return result; } if (e.Detail.StartsWith("确认开始锻造")) { - string msg = Controller.ForgeItem_Complete(uid); - if (msg != "") - { - await SendAsync(e, "确认开始锻造", msg); - } + BotReply reply = Controller.ForgeItem_Complete(uid); + await SendAsync(e, "确认开始锻造", reply); return result; } if (e.Detail.StartsWith("锻造信息")) { - string msg = Controller.ForgeItem_Info(uid); - if (msg != "") - { - await SendAsync(e, "锻造信息", msg); - } + BotReply reply = Controller.ForgeItem_Info(uid); + await SendAsync(e, "锻造信息", reply); return result; } @@ -3266,11 +2909,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (r != -1 && q != -1) { - string msg = Controller.ForgeItem_Master(uid, r, q); - if (msg != "") - { - await SendAsync(e, "大师锻造", msg); - } + BotReply reply = Controller.ForgeItem_Master(uid, r, q); + await SendAsync(e, "大师锻造", reply); } } return result; @@ -3293,11 +2933,8 @@ namespace Oshima.FunGame.WebAPI.Services ids.Add(id); } } - string msg = Controller.MarketSellItem(uid, price, [.. ids]); - if (msg != "") - { - await SendAsync(e, "市场出售", msg); - } + BotReply reply = Controller.MarketSellItem(uid, price, [.. ids]); + await SendAsync(e, "市场出售", reply); return result; } @@ -3313,11 +2950,8 @@ namespace Oshima.FunGame.WebAPI.Services if (strings.Length > 1) _ = int.TryParse(strings[1].Trim(), out count); if (id != -1) { - string msg = Controller.MarketBuyItem(uid, id, count); - if (msg != "") - { - await SendAsync(e, "市场购买", msg); - } + BotReply reply = Controller.MarketBuyItem(uid, id, count); + await SendAsync(e, "市场购买", reply); } } return result; @@ -3326,14 +2960,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("市场查看")) { string detail = e.Detail.Replace("市场查看", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int id)) { - msg = Controller.MarketItemInfo(uid, id); - if (msg.Trim() != "") - { - await SendAsync(e, "市场查看", msg); - } + reply = Controller.MarketItemInfo(uid, id); + await SendAsync(e, "市场查看", reply); } return result; } @@ -3341,14 +2972,11 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("市场下架")) { string detail = e.Detail.Replace("市场下架", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int id)) { - msg = Controller.MarketDelistItem(uid, id); - if (msg.Trim() != "") - { - await SendAsync(e, "市场下架", msg); - } + reply = Controller.MarketDelistItem(uid, id); + await SendAsync(e, "市场下架", reply); } return result; } @@ -3356,57 +2984,48 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("我的市场")) { string detail = e.Detail.Replace("我的市场", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.MarketShowListMySells(uid, page); + reply = Controller.MarketShowListMySells(uid, page); } else { - msg = Controller.MarketShowListMySells(uid, 1); - } - if (msg.Trim() != "") - { - await SendAsync(e, "我的市场", msg); + reply = Controller.MarketShowListMySells(uid, 1); } + await SendAsync(e, "我的市场", reply); return result; } if (e.Detail.StartsWith("我的购买")) { string detail = e.Detail.Replace("我的购买", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.MarketShowListMyBuys(uid, page); + reply = Controller.MarketShowListMyBuys(uid, page); } else { - msg = Controller.MarketShowListMyBuys(uid, 1); - } - if (msg.Trim() != "") - { - await SendAsync(e, "我的购买", msg); + reply = Controller.MarketShowListMyBuys(uid, 1); } + await SendAsync(e, "我的购买", reply); return result; } if (e.Detail.StartsWith("市场")) { string detail = e.Detail.Replace("市场", "").Trim(); - string msg = ""; + BotReply reply = ""; if (int.TryParse(detail, out int page)) { - msg = Controller.MarketShowList(uid, page); + reply = Controller.MarketShowList(uid, page); } else { - msg = Controller.MarketShowList(uid, 1); - } - if (msg.Trim() != "") - { - await SendAsync(e, "市场", msg); + reply = Controller.MarketShowList(uid, 1); } + await SendAsync(e, "市场", reply); return result; } @@ -3435,19 +3054,16 @@ namespace Oshima.FunGame.WebAPI.Services } string content = ""; if (strings.Length > 1) content = string.Join(" ", strings[1..]); - string msg = ""; + BotReply reply = ""; if (useId) { - msg = Controller.Chat(uid, id, content); + reply = Controller.Chat(uid, id, content); } else { - msg = Controller.Chat_Name(uid, name, content); - } - if (msg != "") - { - await SendAsync(e, "私信", msg); + reply = Controller.Chat_Name(uid, name, content); } + await SendAsync(e, "私信", reply); return result; } @@ -3464,11 +3080,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomCreate(uid, "horseracing", "", groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "赛马", msg); - } + BotReply reply = Controller.RoomCreate(uid, "horseracing", "", groupId); + await SendAsync(e, "赛马", reply); } else { @@ -3490,11 +3103,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomCreate(uid, "cooperative", "", groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomCreate(uid, "cooperative", "", groupId); + await SendAsync(e, "房间", reply); } else { @@ -3516,11 +3126,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomCreate(uid, "mix", "", groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomCreate(uid, "mix", "", groupId); + await SendAsync(e, "房间", reply); } else { @@ -3542,11 +3149,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomCreate(uid, "team", "", groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomCreate(uid, "team", "", groupId); + await SendAsync(e, "房间", reply); } else { @@ -3570,11 +3174,8 @@ namespace Oshima.FunGame.WebAPI.Services { if (FunGameConstant.Rooms.Values.FirstOrDefault(r => r.GameMap == groupId) is Room room) { - string msg = Controller.RoomInto(uid, room.Roomid, ""); - if (msg.Trim() != "") - { - await SendAsync(e, "赛马", msg); - } + BotReply reply = Controller.RoomInto(uid, room.Roomid, ""); + await SendAsync(e, "赛马", reply); } else { @@ -3613,11 +3214,8 @@ namespace Oshima.FunGame.WebAPI.Services password = detail[(firstSpaceIndex + 1)..].Trim(); } } - string msg = Controller.RoomCreate(uid, roomType, password, groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomCreate(uid, roomType, password, groupId); + await SendAsync(e, "房间", reply); } else { @@ -3651,11 +3249,8 @@ namespace Oshima.FunGame.WebAPI.Services password = detail[(firstSpaceIndex + 1)..].Trim(); } } - string msg = Controller.RoomInto(uid, roomid, password); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomInto(uid, roomid, password); + await SendAsync(e, "房间", reply); } else { @@ -3713,11 +3308,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomQuit(uid); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomQuit(uid); + await SendAsync(e, "房间", reply); } else { @@ -3739,11 +3331,8 @@ namespace Oshima.FunGame.WebAPI.Services } if (groupId != "") { - string msg = Controller.RoomShowList(uid, groupId); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomShowList(uid, groupId); + await SendAsync(e, "房间", reply); } else { @@ -3754,71 +3343,50 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "房间信息") { - string msg = Controller.RoomInfo(uid); - if (msg.Trim() != "") - { - await SendAsync(e, "房间", msg); - } + BotReply reply = Controller.RoomInfo(uid); + await SendAsync(e, "房间", reply); return result; } if (e.Detail == "排行榜" || e.Detail == "养成排行榜") { - string msg = Controller.GetRanking(uid, 2); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 2); + await SendAsync(e, "排行榜", reply); return result; } if (e.Detail == $"{General.GameplayEquilibriumConstant.InGameCurrency}排行榜") { - string msg = Controller.GetRanking(uid, 0); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 0); + await SendAsync(e, "排行榜", reply); return result; } if (e.Detail == $"{General.GameplayEquilibriumConstant.InGameMaterial}排行榜") { - string msg = Controller.GetRanking(uid, 1); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 1); + await SendAsync(e, "排行榜", reply); return result; } if (e.Detail == $"赛马排行榜") { - string msg = Controller.GetRanking(uid, 3); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 3); + await SendAsync(e, "排行榜", reply); return result; } if (e.Detail == $"共斗排行榜") { - string msg = Controller.GetRanking(uid, 4); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 4); + await SendAsync(e, "排行榜", reply); return result; } if (e.Detail == $"锻造排行榜") { - string msg = Controller.GetRanking(uid, 5); - if (msg.Trim() != "") - { - await SendAsync(e, "排行榜", msg); - } + BotReply reply = Controller.GetRanking(uid, 5); + await SendAsync(e, "排行榜", reply); return result; } @@ -3841,11 +3409,8 @@ namespace Oshima.FunGame.WebAPI.Services else cid = id; } } - string msg = Controller.AddItemsToCharacter(uid, cid, [.. ids]); - if (msg != "") - { - await SendAsync(e, "加物", msg); - } + BotReply reply = Controller.AddItemsToCharacter(uid, cid, [.. ids]); + await SendAsync(e, "加物", reply); return result; } @@ -3869,11 +3434,8 @@ namespace Oshima.FunGame.WebAPI.Services else cid = id; } } - string msg = Controller.RemoveItemsFromCharacter(uid, cid, [.. ids]); - if (msg != "") - { - await SendAsync(e, "减物", msg); - } + BotReply reply = Controller.RemoveItemsFromCharacter(uid, cid, [.. ids]); + await SendAsync(e, "减物", reply); return result; } @@ -3885,11 +3447,8 @@ namespace Oshima.FunGame.WebAPI.Services if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase)) { - string msg = Controller.Relaod(uid); - if (msg != "") - { - await SendAsync(e, "重载FunGame", msg); - } + BotReply reply = Controller.Relaod(uid); + await SendAsync(e, "重载FunGame", reply); return result; } }