public object SendPasswordRedPacket( [KouPluginArgument(Name = "总金额", NumberMin = 1, DefaultNumberRangeError = true)] int total, [KouPluginArgument(Name = "数量", NumberMin = 1, DefaultNumberRangeError = true)] int quantity, [KouPluginArgument(Name = "口令(默认生成6位数字)")] string password = null) { if (password == "") { password = null; } if (!ValidateAvailableTime()) { return(ConveyMessage); } KouRedPacket redPacket = new KouRedPacket(CurrentPlatformUser, total, quantity, IsIdentical, password, Duration) { EndAction = RedPacketEndAction, IsCompeteInVelocity = IsCompeteInVelocity, Remark = Remark }; if (redPacket.TotalCoins / redPacket.TotalCount == 0) { return($"每人至少需要有{CurrentGlobalKouConfig.CoinFormat(1)}"); } var rest = CurrentUser.CoinFree - redPacket.TotalCoins; if (rest >= 0) { string ask = $"发送总额为{CurrentGlobalKouConfig.CoinFormat(redPacket.TotalCoins)}的{quantity}个{IsCompeteInVelocity.BeIfTrue("竞速")}红包{password?.Be($"(口令为\"{password}\")")}" + $"(成功后余额为{CurrentGlobalKouConfig.CoinFormat(rest)})\n" + $"输入\"y\"确认"; if (!SessionService.AskConfirm(ask)) { return(null); } if (IsCompeteInVelocity) { CurrentPlatformUser.SendMessage(CurrentPlatformGroup, "将随机在5~30秒内发送竞速红包"); Thread.Sleep(RandomTool.GenerateRandomInt(5000, 30000)); } if (!redPacket.Sent()) { return("发红包失败" + redPacket.ErrorMsg?.Be($",{redPacket.ErrorMsg}")); } return($"发送红包成功!{redPacket.ToString(FormatType.Customize1)}"); } return(this.ReturnNullWithError(null, ErrorCodes.Core_BankNotEnoughMoney)); }